DirectXShaderCompiler
DirectXShaderCompiler copied to clipboard
Infinite loop in SemaHLSL when compiling weird array
Description
DXC loops indefinitely when building a simple HLSL shader with a weird array initializer. Affects both DXIL and SPIR-V.
Seems like the loop is in SemaHLSL.cpp:
Process 3039522 stopped
* thread #1, name = 'dxc', stop reason = step over
frame #0: 0x00007ffff57eb0c2 libdxcompiler.so`FlattenedTypeIterator::FlattenedTypeIterator(this=0x00007fffffff2fe0, loc=(ID = 46), type=QualType @ 0x00007fffffff2df0, source=0x0000555555a02310) at SemaHLSL.cpp:11857:7
11854 m_incompleteCount(0), m_typeDepth(0), m_loc(loc) {
11855 if (pushTrackerForType(type, nullptr)) {
11856 while (!m_typeTrackers.empty() && !considerLeaf())
-> 11857 consumeLeaf();
11858 }
11859 }
11860
Steps to Reproduce
[numthreads(1, 1, 1)]
void main() {
float array[1][0] = { {} };
}
./build/bin/dxc -T cs_6_0 -E main loop.hlsl
Environment
- DXC version: HEAD (130877392c263888ef06bab768856d3dab1f1c9a)
- Host Operating System : linux
@Keenuts - at the moment it doesn't look like MS will be investigating this any time soon. Is this something that you're planning on look into?
Hi, I am not planning on working on this one in the immediate future either, just adding the issues to track them.