microsoft / microsoft/DirectXShaderCompiler

Fixed size array assignment causes assert

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

Nobody has claimed this yet.

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

Description

Description
A compiler assert is hit when attempting to do a fixed array value assignment. I would expect a compiler error to be emitted instead, with a clean exit.

Steps to Reproduce

https://godbolt.org/z/jcr6WT8b6

Compile the following minimum repro with dxc -T as_6_5 -E as_main bug.hlsl

struct MS_Payload {
    float2 uvs[4];
};

[NumThreads(1, 1, 1)]
void as_main() {

    float2 UVS[4] = {
        float2(0, 0),
        float2(0, 1),
        float2(1, 1),
        float2(1, 0),
    };

    MS_Payload payload;
    payload.uvs = UVS; // <-- here

    DispatchMesh(1, 1, 1, payload);
}

Actual Behavior
Yields error: cast<X>() argument of incompatible type!

Stack trace when used via libdxcompiler.dylib:

Image

Environment

./dxc --version
libdxcompiler.dylib: 1.9(dev;5011-dc85cd71)

macOS Sequoia 15.6

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

Begin with the Godbolt minimum repro and run it using dxc -T as_6_5 -E as_main bug.hlsl to reproduce the assertion. Trace the reported cast<X>() failure in the compiler, then verify that the fixed-array assignment produces a clean compiler diagnostic and exit instead of asserting.

Written by the indexing model from the issue text.

Assessment

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.