Skip to content

Segfault when calling sizeof() on templated type #7510

@MarijnS95

Description

@MarijnS95

Description

We just upgraded to the latest May 2025 release, from a previous self-compiled build at 47e11af. One of our shaders triggers a SIGSEGV right inside DXC. This seems to be caused by calling sizeof() on a templated type, regardless of what the struct contains. It doesn't seem to need to use T in any capacity for this to trigger.

Steps to Reproduce

https://godbolt.org/z/hnfd5EEGY (DXC on trunk, this doesn't have an explicit tagged 1.8.2505 release just yet)

template<typename T> struct Encoded{
    // uint x;
    // T y;
};

[numthreads(8, 8, 1)]
void main(uint2 tid : SV_DispatchThreadID) {
    uint s = sizeof(Encoded<int>);
}

It doesn't matter if we compile to DXIL or SPIR-V.

Environment

  • DXC version: v1.8.2505 (using the library)
  • Host Operating System: Windows, MacOS (Linux untested, but likely to fail as well)

Given that we have a known-working commit, bisection should only contain these 51 commits:

47e11af...v1.8.2505

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug, regression, crash

    Type

    No type

    Projects

    Status

    Triaged

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions