aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/const9.rs
blob: e71a62a33b1e1572fd5d2e8e411a76285cddfbe5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// { dg-options "-w -O0 -fdump-tree-gimple" }
const fn test(mut x: i32) -> i32 {
    loop {
        if x == 10 {
            break;
        }

        x = x + 1;
    }
    return x;
}

const X: i32 = test(0);

fn main() {
    // { dg-final { scan-tree-dump-times {x = 10} 1 gimple } }
    let x = X;
}