microsoft / microsoft/DirectXShaderCompiler
semantics: Index out of bounds error when asserts are enabled
Open
Nobody has claimed this yet.
bug
incorrect-code
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
Seems like this issue is debug/assert only, so not showing in the release nor godbolt.
struct SI {
float a : A3;
float b : A4;
};
struct S {
float a : A;
SI b : A;
};
[shader("pixel")]
float main(float a : A, S s, float b : A1) : SV_Target {
return a + s.a + s.b.a + s.b.b + b;
}
dxc -T ps_6_0 -E main /tmp/a.hlsl
arg index out of boundError: assert(false && "arg index out of bound")
File:
lib/Transforms/Scalar/ScalarReplAggregatesHLSL.cpp(4782)
Func: AllocateSemanticIndex
Illegal instruction (core dumped)
- DXC version: f94396ddffa8562a00d64a1db58d3f73f33b655a
- 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
Reproduce the failure with the provided HLSL source and dxc command, then inspect lib/Transforms/Scalar/ScalarReplAggregatesHLSL.cpp around line 4782, where AllocateSemanticIndex reports the out-of-bounds assertion. Done means the reproducer no longer aborts when assertions are enabled and its shader compilation completes as expected.
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
- Mostly clear
- Newbie friendliness
- 45/100