You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
i128::saturating_add returns -1 instead of i128::MAX at -O2 with the gcc backend #1027
Expected 170141183460469231731687303715884105727 (i128::MAX), which is what -Copt-level=0/1, the LLVM backend at every level, and Miri print. -Copt-level=3 also prints -1.
Variants
Also wrong: an i128 field of a #[repr(packed)] struct (saturating_add(1) on MAX gives -1, saturating_sub(1) on MIN gives -2); read_unaligned; a field of a #[repr(align(32))] struct.
Correct: passing the i128 by value; u128; i64; checked_add / overflowing_add on the same load.
Only the saturating case is wrong: 5.saturating_add(1) gives 6.
Versions: rustc 1.102.0-nightly (5b7b37aef 2026-11-08), libgccjit 17.0.0 20261006, x86_64-unknown-linux-gnu. Wrong on every nightly that ships rustc-codegen-gcc (checked 2026-06-05, 2026-09-01, 2026-11-08).
Activity