microsoft / microsoft/DirectXShaderCompiler
When using "--variable" as an argument to an inout function, 2 is subtracted not one
Open
Nobody has claimed this yet.
bug
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
https://godbolt.org/z/73so7qzzW
void Func(inout uint byteOffset)
{
}
uint PSMain(uint i : I) : SV_TARGET
{
Func(--i); // Subtracts 2...
return i;
}
The resulting DXIL has an "Add minus two" operation, not "add minus one".
%2 = add i32 %1, -2, !dbg !37
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 provided HLSL example using the linked Godbolt case and inspect the generated DXIL for the decrement applied through the inout argument. Trace the compiler path responsible for this expression and confirm the output uses an add-minus-one operation rather than add-minus-two.
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