microsoft / microsoft/DirectXShaderCompiler

Use of "float1" can cause assert/missing switch case

Open
#6,861 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Description
Compiling the below code hits an assert (a missing case in SemaHLSL.cpp's FlattenedTypeIterator::pushTrackerForType).
"objectKind" is ArTypeObjectKind::AR_TOBJ_POINTER, which is missing from the switch.

Steps to Reproduce
dxc -Tcs_6_6

ByteAddressBuffer inBuffer : register(t0);
RWByteAddressBuffer bufferArray[] : register(u0);

[numthreads(1, 1, 1)]
void main()
{
  // Simple read
  float1 dynamicBufferIndex = inBuffer.Load(0);

  // Dynamically indexed write
  bufferArray[dynamicBufferIndex].Store(0, 1));
}

Actual Behavior
Assert in debug.

Environment

  • dxcompiler.dll: 1.8 - 1.8.0.4583 (PIX_MemberFunctions, 2f4a01af1-dirty)
  • Win11, recent insider build

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

Start with SemaHLSL.cpp and FlattenedTypeIterator::pushTrackerForType, then run the provided dxc -Tcs_6_6 reproduction using the float1 dynamic index. Trace the pointer object kind through the switch and verify that the regression no longer asserts in a debug build, ideally with coverage for the shown shader.

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
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.