microsoft / microsoft/DirectXShaderCompiler
Undefined value allowed for buffer load index
Open
Nobody has claimed this yet.
bug
dxil
incorrect-code
validation
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
This shader compiles without warning or error even though the load address is undef.
// dxc /Tps_6_0 t.hlsl
ByteAddressBuffer b;
[RootSignature("UAV(u0), SRV(t0)")]
float main(uint a : A) : SV_Target
{
uint X;
return b.Load(X);
}
The generated dxil has undef for the index
call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32(i32 68, %dx.types.Handle %1, i32 undef, i32 undef)
FXC will produce an error for this shader
t.hlsl(7,12-20): warning X4000: use of potentially uninitialized variable (X)
t.hlsl(7,12-20): error X4575: reading uninitialized value
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 reproducing the shader with the shown dxc command and compare its diagnostics with FXC's X4000 and X4575 messages. Trace the compiler's handling of the uninitialized buffer-load index; done means dxc rejects this shader instead of emitting DXIL with an undef index.
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
- Clearly specified
- Newbie friendliness
- 38/100