about summary refs log tree commit diff
path: root/tests/ui/codegen/i128-shift-overflow-check-76042.rs
blob: 7ae0806216cd676d35cecbe2425c40547422bf38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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!();
    }
}