Skip to content

[SPIR-V] SIGSEGV when copying template types from constant buffers into local variables #7288

Open

Description

@alexge50

Description
Compiler crashes when attempting to copy a templated type from ConstantBuffer<>, into a local variable of the same type. This only happens in SPIR-V mode. A similar code works when copying field by field.

Steps to Reproduce
https://godbolt.org/z/1o1Tee8v9
Working version (copying field-by-field): https://godbolt.org/z/P3ojzxxTW

Actual Behavior
Internal Compiler Crash, with SIGSEGV

Environment

  • DXC version: DXC (trunk) on godbolt
  • Host Operating System: Godbolt/Linux

Activity

  1. added
    bug
    needs-triage
    spirv
    on Apr 1, 2025
  2. s-perron commented on May 14, 2025

    @s-perron
    Collaborator

    We have not implemented the "flat conversion" from the constant buffer to the type in the constant buffer. Here is the part of the AST that we are failing on:

      | |   `-ImplicitCastExpr 0x55cf719a7a70 <col:25> 'Uniform<vector<float, 4> >' <FlatConversion>
      | |     `-ImplicitCastExpr 0x55cf719a7a58 <col:25> 'ConstantBuffer<Uniform<float4> >':'ConstantBuffer<Uniform<vector<float, 4> > >' <LValueToRValue>
      | |       `-DeclRefExpr 0x55cf719a7a18 <col:25> 'ConstantBuffer<Uniform<float4> >':'ConstantBuffer<Uniform<vector<float, 4> > >' lvalue Var 0x55cf719a6238 'uniforms' 'ConstantBuffer<Uniform<float4> >':'ConstantBuffer<Uniform<vector<float, 4> > >'
    

    We fail when we hit this assert:

    llvm_unreachable("Trying to generate a type that we cannot generate");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugspirv

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions