Prevent miscompilation in trivial loop {}
Ideally, we would want to handle a broader set of cases to fully fix the underlying bug here. That is currently relatively expensive at compile and runtime, so we don't do that for now.
This commit is contained in:
parent
7f58716810
commit
e2efec8976
5 changed files with 42 additions and 9 deletions
15
src/test/codegen/loop.rs
Normal file
15
src/test/codegen/loop.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// compile-flags: -C opt-level=3
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// CHECK-LABEL: @check_loop
|
||||
#[no_mangle]
|
||||
pub fn check_loop() -> u8 {
|
||||
// CHECK-NOT: unreachable
|
||||
call_looper()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
fn call_looper() -> ! {
|
||||
loop {}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue