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 |
||
|---|---|---|
| .. | ||
| bench | ||
| bench-radar | ||
| compiler | ||
| elabissues | ||
| ir | ||
| lake | ||
| lean | ||
| pkg | ||
| playground | ||
| plugin | ||
| simpperf | ||
| .gitignore | ||
| common.sh | ||
| lakefile.toml | ||
| lean-toolchain | ||