gcc/testsuite/rust/compile/const4.rs
raw| 1 | // { dg-options "-w -O0 -fdump-tree-gimple" } |
| 2 | const A: i32 = 1; |
| 3 | |
| 4 | const fn test(a: i32) -> i32 { |
| 5 | let b = A + a; |
| 6 | if b == 2 { |
| 7 | return b + 2; |
| 8 | } |
| 9 | a |
| 10 | } |
| 11 | |
| 12 | const B: i32 = test(1); |
| 13 | const C: i32 = test(12); |
| 14 | |
| 15 | fn main() { |
| 16 | // { dg-final { scan-tree-dump-times {a = 1} 1 gimple } } |
| 17 | let a = A; |
| 18 | // { dg-final { scan-tree-dump-times {b = 4} 1 gimple } } |
| 19 | let b = B; |
| 20 | // { dg-final { scan-tree-dump-times {c = 12} 1 gimple } } |
| 21 | let c = C; |
| 22 | } |