diff options
| author | bors <bors@rust-lang.org> | 2022-03-03 12:56:24 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-03-03 12:56:24 +0000 |
| commit | 92b6955b12a11d8c1e60fc08e8245d5d55f3a4fb (patch) | |
| tree | d62aa4820f4133331b3c100e69d3022e5be1c6ba | |
| parent | 7f44a753ce21ad8be1f77bbfb1e21b14d1bb8194 (diff) | |
| parent | c45a42a3327baeb6bfd05a0d95e795a9e65a88b2 (diff) | |
| download | rust-92b6955b12a11d8c1e60fc08e8245d5d55f3a4fb.tar.gz rust-92b6955b12a11d8c1e60fc08e8245d5d55f3a4fb.zip | |
Auto merge of #94512 - RalfJung:sdiv-ub, r=oli-obk
Miri/CTFE: properly treat overflow in (signed) division/rem as UB To my surprise, it looks like LLVM treats overflow of signed div/rem as UB. From what I can tell, MIR `Div`/`Rem` directly lowers to the corresponding LLVM operation, so to make that correct we also have to consider these overflows UB in the CTFE/Miri interpreter engine. r? `@oli-obk`
| -rw-r--r-- | tests/ui/modulo_one.stderr | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/ui/modulo_one.stderr b/tests/ui/modulo_one.stderr index 34f762bbb92..03f460897fc 100644 --- a/tests/ui/modulo_one.stderr +++ b/tests/ui/modulo_one.stderr @@ -1,18 +1,18 @@ -error: this arithmetic operation will overflow +error: this operation will panic at runtime --> $DIR/modulo_one.rs:11:5 | LL | i32::MIN % (-1); // also caught by rustc | ^^^^^^^^^^^^^^^ attempt to compute the remainder of `i32::MIN % -1_i32`, which would overflow | - = note: `#[deny(arithmetic_overflow)]` on by default + = note: `#[deny(unconditional_panic)]` on by default -error: this arithmetic operation will overflow +error: this operation will panic at runtime --> $DIR/modulo_one.rs:21:5 | LL | INT_MIN % NEG_ONE; // also caught by rustc | ^^^^^^^^^^^^^^^^^ attempt to compute the remainder of `i64::MIN % -1_i64`, which would overflow -error: this arithmetic operation will overflow +error: this operation will panic at runtime --> $DIR/modulo_one.rs:22:5 | LL | INT_MIN % STATIC_NEG_ONE; // ONLY caught by rustc |
