microsoft / microsoft/DirectXShaderCompiler
Can construct-cast an array type to non-array without compiler complaining (DXIL Crash)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
I have a member in a struct of type uint _pad[1]
if turns out its possible for me to do
float(obj._pad)
without the compiler warning or complaining, and it will even emit on the OpLoad-ed access chain
%25 = OpCompositeExtract %uint %24 0
so this behaves as-if I did float(obj._pad[0]) ?
Is this intended behaviour?
Steps to Reproduce
https://godbolt.org/z/dqa1jG41b
Actual Behavior
No warnings or errors about what I'm doing.
Environment
- DXC version: Latest on Godbolt
- 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
Start with the linked Godbolt reproduction using the latest DXC build and compare the accepted cast with the emitted SPIR-V access chain. Read the compiler's handling of array-to-scalar construct casts and determine whether the behavior should produce a diagnostic. Done means the behavior is corrected or its intended semantics are clearly established with coverage for this case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100