microsoft / microsoft/DirectXShaderCompiler
Zero initializing array of struct causes error: cast<X>() argument of incompatible type!
Open
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
Compiling the following HLSL causes an internal compiler error:
repro.hlsl:
struct s {
float f;
float2x4 m;
};
struct t {
s a[1];
};
static t g = (t)0;
[numthreads(1, 1, 1)]
void main() {
s h = g.a[0u];
}
Steps to Reproduce
dxc -T cs_6_6 repro.hlsl
Godbolt repro: https://godbolt.org/z/1Pqb7odes
Actual Behavior
error: cast<X>() argument of incompatible type!
Environment
- DXC version: libdxcompiler.dylib: 1.10(dev;5155-60a1c856); libdxil.dylib: 1.10
- Host Operating System: macOS
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
Start by saving the supplied code as repro.hlsl and running dxc -T cs_6_6 repro.hlsl to reproduce the incompatible-type error. Trace the compiler path handling the zero cast for the nested struct and array, then verify that the repro compiles without the internal error.
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
- 48/100