DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

dxc crashes on empty embedded struct

Open danbrown-amd opened this issue 5 years ago • 0 comments

Confirmed for b44890fe1e.

// empty_embedded_struct.hlsl
struct s0 {};
struct s1 { s0 a; uint b; };
s1 main() : OUT { s1 s; return s; }

// $ dxc -T vs_6_2 -E main -Fc empty_embedded_struct.dxil empty_embedded_struct.hlsl
// Internal compiler error: Terminal Error 0x80000003

The crash occurs during the SROA pass. The lookup near the end of SROA_Parameter_HLSL::allocateSemanticIndex() (Type *semanticTy = semanticTypeMap[semantic];) fails because the value of semantic is the pseudo-semantic * rather than OUT, and AllocateSemanticIndex() attempts to dereference the resulting null pointer.

danbrown-amd avatar May 14 '21 00:05 danbrown-amd