aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.zig
diff options
context:
space:
mode:
authorIvan Stepanov <ivanstepanovftw@gmail.com>2025-07-01 14:25:04 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2025-07-01 19:26:21 +0200
commitee6d19480da53b3a351749e2a7b18c45ad072018 (patch)
tree22309b2a5cb5f383d0892c2da8908876341fdb9d /src/codegen.zig
parentb8ac740a1b072168c24785cf8d1c8315ed6db8b0 (diff)
downloadzig-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/codegen.zig')
0 files changed, 0 insertions, 0 deletions