microsoft / microsoft/DirectXShaderCompiler

Infinite loop when building 0-sized array as local variable

Open
#7,719 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.