Return zero for signed MIN remainder -1 in LLVM lowering
Problem
The approved integer remainder result for signed MIN % -1 is zero, but LLVM paths emit an unguarded srem. Hardware traps and LLVM poison make accepted source optimization-dependent.
Reproduction and evidence
Audited canonical master 69a67c6e0fb700f37ee6114f5a66d37ee13771a5 (0.0.1-alpha-dev). Matching checkout-built compiler/std were used for compiler probes on Linux amd64 with Rust 1.89.0 and LLVM 21.1.8. Artifact inspection, mocked/projection checks and foreign-target object emission are identified below and are not native execution on those operating systems.
fun main()->i32{var x:i32=-2147483648;var y:i32=-1;return x%y;}
target/debug/wavec --std-root "$PWD/std" build repro.wave -O0 --run --out-dir out-O0
target/debug/wavec --std-root "$PWD/std" build repro.wave -O2 --run --out-dir out-O2
Observed on Linux amd64: O0 SIGFPE; O2 happened to exit 40, not a stable result to assert. The equivalent x%=y also reproduces. Direct return -2147483648 % -1; emits ret i32 poison in actual IR. No invalid memory fixture or Rust toolchain vulnerability is involved.
Scope
Guard/normalize the LLVM remainder boundary for ordinary and compound expressions using the established zero result. Preserve the separate division overflow/zero-divisor rules and operand evaluation order.
Starting points: llvm/src/codegen/conversions.rs:217, llvm/src/expression/rvalue/assign.rs:374.
Completion criteria
- [ ] Runtime and constant signed MIN%-1 yield zero at O0/O2.
- [ ] Cover relevant integer widths and compound forms.
- [ ] Retain single evaluation and the distinct MIN/-1 division policy; do not infer behavior from a poison exit value.
Related: #870, #872. Related broad trackers or completed implementations are context, not claims that their entire scope is unfinished.