summaryrefslogtreecommitdiffstats
path: root/tests/ui/mir/simplify-branch-same.rs
blob: d631c33d61f8415f889681379ceecc2cac7e12ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Regression test for SimplifyBranchSame miscompilation.
// run-pass

macro_rules! m {
    ($a:expr, $b:expr, $c:block) => {
        match $a {
            Lto::Fat | Lto::Thin => { $b; (); $c }
            Lto::No => { $b; () }
        }
    }
}

pub enum Lto { No, Thin, Fat }

fn f(mut cookie: u32, lto: Lto) -> u32 {
    let mut _a = false;
    m!(lto, _a = true, {cookie = 0});
    cookie
}

fn main() { assert_eq!(f(42, Lto::Thin), 0) }