DirectXShaderCompiler
DirectXShaderCompiler copied to clipboard
Can construct-cast an array type to non-array without compiler complaining (DXIL Crash)
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?
The SPIR-V behavior here matches FXC: https://shader-playground.timjones.io/36dfb3e4879857ee6023e3216148ae76
DXC crashes when generating DXIL for this code: https://godbolt.org/z/97GMh3zjd
So I think the only bug here is that DXC is crashing in DXIL, and we should probably issue a diagnostic on array->scalar truncation.