diff options
| author | Ivan Stepanov <ivanstepanovftw@gmail.com> | 2025-07-01 14:25:04 +0200 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2025-07-01 19:26:21 +0200 |
| commit | ee6d19480da53b3a351749e2a7b18c45ad072018 (patch) | |
| tree | 22309b2a5cb5f383d0892c2da8908876341fdb9d /src/zig_llvm.cpp | |
| parent | b8ac740a1b072168c24785cf8d1c8315ed6db8b0 (diff) | |
| download | zig-ee6d19480da53b3a351749e2a7b18c45ad072018.tar.gz zig-ee6d19480da53b3a351749e2a7b18c45ad072018.zip | |
spirv: fix signed overflow detection for safe subtraction
The overflow check for safe signed subtraction was using the formula (rhs < 0) == (lhs > result). This logic is flawed and incorrectly reports an overflow when the right-hand side is zero.
For the expression 42 - 0, this check evaluated to (0 < 0) == (42 > 42), which is false == false, resulting in true. This caused the generated SPIR-V to incorrectly branch to an OpUnreachable instruction, preventing the result from being stored.
Fixes #24281.
Diffstat (limited to 'src/zig_llvm.cpp')
0 files changed, 0 insertions, 0 deletions
