lean4-htt/tests
Kim Morrison 67ba4da71f
fix: avoid SIGFPE on x86_64 for signed integer division overflow (#11624)
This PR fixes a SIGFPE crash on x86_64 when evaluating `INT_MIN / -1` or
`INT_MIN % -1` for signed integer types.

On x86_64, the `idiv` instruction traps when the quotient overflows the
destination register. For signed integers, `INT_MIN / -1` produces a
result that overflows (e.g., `-2147483648 / -1 = 2147483648` which
doesn't fit in Int32). ARM64's `sdiv` instruction wraps instead of
trapping.

The fix:
- For Int8/Int16/Int32: widen to the next larger type before
dividing/modding, then truncate back
- For Int64: explicitly check for the overflow case and return the
wrapped result

Fixes #11612

🤖 Prepared with Claude Code
2025-12-13 02:42:33 +00:00
..
bench chore: benchmark for charactersIn (#11643) 2025-12-12 22:23:51 +00:00
bench-radar chore: measure dynamic symbols in benchmarks (#11568) 2025-12-11 16:10:27 +00:00
compiler chore: minor String API improvements (#11439) 2025-12-01 11:44:14 +00:00
elabissues
ir
lake feat: module system is no longer experimental (#11637) 2025-12-12 21:20:26 +00:00
lean fix: avoid SIGFPE on x86_64 for signed integer division overflow (#11624) 2025-12-13 02:42:33 +00:00
pkg feat: module system is no longer experimental (#11637) 2025-12-12 21:20:26 +00:00
playground
plugin
simpperf
.gitignore
common.sh feat: module system is no longer experimental (#11637) 2025-12-12 21:20:26 +00:00
lakefile.toml feat: module system is no longer experimental (#11637) 2025-12-12 21:20:26 +00:00
lean-toolchain