]> git.proxmox.com Git - rustc.git/blame - src/test/codegen/non-terminate/nonempty-infinite-loop.rs
Update unsuspicious file list
[rustc.git] / src / test / codegen / non-terminate / nonempty-infinite-loop.rs
CommitLineData
6a06907d
XL
1// compile-flags: -C opt-level=3
2
3#![crate_type = "lib"]
4
5// Verify that we don't miscompile this even if rustc didn't apply the trivial loop detection to
6// insert the sideeffect intrinsic.
7
8fn infinite_loop() -> u8 {
9 let mut x = 0;
10 // CHECK-NOT: sideeffect
11 loop {
12 if x == 42 {
13 x = 0;
14 } else {
15 x = 42;
16 }
17 }
18}
19
20// CHECK-LABEL: @test
21#[no_mangle]
22fn test() -> u8 {
23 // CHECK-NOT: unreachable
24 // CHECK: br label %{{.+}}
25 // CHECK-NOT: unreachable
26 let x = infinite_loop();
27 x
28}