microsoft / microsoft/DirectXShaderCompiler
Infinite loop when building 0-sized array as local variable
Open
Nobody has claimed this yet.
bug
incorrect-code
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
Issue which occurs for both backends, infinite loop in SEMA
Steps to Reproduce
// RUN: %dxc -T ps_6_0 -E main %s -spirv
RWStructuredBuffer<uint> output[2];
float4 main(float2 uv : TEXCOORD) : SV_TARGET {
RWStructuredBuffer<uint> copy[2][0] = output;
return uv.xyxy;
}
Actual Behavior
DXC never finishes. Infinite loop in SemaHLSL.cpp in the FlattenedTypeIterator constructor.
Environment
- DXC version: HEAD
- Host Operating System: Linux
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the HLSL reproducer with the shown %dxc command and inspect the FlattenedTypeIterator constructor in SemaHLSL.cpp. Use the reproducer as a regression test and confirm that compiling the zero-sized local array terminates on both backends without the infinite loop.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100