about summary refs log tree commit diff
path: root/tests/ui/codegen/i128-shift-overflow-check-76042.rs
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2025-08-20 08:14:57 +0000
committerGitHub <noreply@github.com>2025-08-20 08:14:57 +0000
commit46765526e33dca91b3860715097aa43efe2cf5da (patch)
treec790c7a6d94c4d2c96b820cc93804ec55af4bdbe /tests/ui/codegen/i128-shift-overflow-check-76042.rs
parent49abb66e5d199497830b88397f2218cbe4b978f1 (diff)
parent5556212823c359619302748e9280258c11799db1 (diff)
downloadrust-46765526e33dca91b3860715097aa43efe2cf5da.tar.gz
rust-46765526e33dca91b3860715097aa43efe2cf5da.zip
Merge pull request #4532 from rust-lang/rustup-2025-08-20
Automatic Rustup
Diffstat (limited to 'tests/ui/codegen/i128-shift-overflow-check-76042.rs')
-rw-r--r--tests/ui/codegen/i128-shift-overflow-check-76042.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/codegen/i128-shift-overflow-check-76042.rs b/tests/ui/codegen/i128-shift-overflow-check-76042.rs
new file mode 100644
index 00000000000..7ae0806216c
--- /dev/null
+++ b/tests/ui/codegen/i128-shift-overflow-check-76042.rs
@@ -0,0 +1,17 @@
+// https://github.com/rust-lang/rust/issues/76042
+//@ run-pass
+//@ compile-flags: -Coverflow-checks=off -Ccodegen-units=1 -Copt-level=0
+
+fn foo(a: i128, b: i128, s: u32) -> (i128, i128) {
+    if s == 128 {
+        (0, 0)
+    } else {
+        (b >> s, a >> s)
+    }
+}
+fn main() {
+    let r = foo(0, 8, 1);
+    if r.0 != 4 {
+        panic!();
+    }
+}