Skip to content

Infinite loop in SemaHLSL when compiling weird array #6407

@Keenuts

Description

@Keenuts

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 (1308773)
  • Host Operating System : linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug, regression, crashincorrect-codeIssues relating to handling of incorrect code

    Type

    No type

    Projects

    Status

    Triaged

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions