Skip to content

[SPIR-V] DXC crash with buffer assignment + template function #6877

@jukim-nv

Description

@jukim-nv

Description
We are seeing a crash in our shader debug code which uses template functions to output strings to a RWByteAddressBuffer.

Only SPIR-V compilation crashes. DXIL compilation works fine.

Steps to Reproduce
This is the most minimal shader that I have found to reproduce the problem:

RWByteAddressBuffer u_OutputBuffer : register(u0); template<typename T, uint N> uint StrLen(T str[N]) { // Includes the null terminator return N; } [numthreads(1, 1, 1)] void main() { // commenting out either of these lines makes compilation succeed // calling StrLen() on a non-string array instead also appears to compile successfully const uint unusedStrLen = StrLen("test_string"); RWByteAddressBuffer unusedBuffer = u_OutputBuffer; } 

DXC command line used to reproduce:

dxc.exe repro.hlsl -T cs_6_5 -E main -spirv 

Actual Behavior
Compilation crashes with error

Internal compiler error: access violation. Attempted to read from address 0x0000000000000000 

Environment

  • Reproduced with DXC July 2024 release dxcompiler.dll: 1.8 - 1.8.2407.7 (416fab6b5); dxil.dll: 1.8(101.8.2407.12)
  • Reproduced with DXC from Vulkan SDK 1.3.290.0 dxcompiler.dll: 1.8 - 1.8.0.4650 (49d1ae9a0); dxil.dll: 1.5(10.0.19041.1001)
  • Host Operating System: Windows 10 19045.4046

Metadata

Metadata

Assignees

Labels

bugBug, regression, crashspirvWork related to SPIR-V

Type

No type

Projects

Status

Done

Status

Triaged

Relationships

None yet

Development

No branches or pull requests

Issue actions