Skip to content

Commit 39cd1da

Browse files
committed
Add mir-opt test for asm_unwind + panic=abort
1 parent f45f826 commit 39cd1da

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// MIR for `main` after AbortUnwindingCalls
2+
3+
fn main() -> () {
4+
let mut _0: (); // return place in scope 0 at $DIR/asm_unwind_panic_abort.rs:11:11: 11:11
5+
let _1: (); // in scope 0 at $DIR/asm_unwind_panic_abort.rs:13:9: 13:49
6+
scope 1 {
7+
}
8+
9+
bb0: {
10+
StorageLive(_1); // scope 1 at $DIR/asm_unwind_panic_abort.rs:13:9: 13:49
11+
_1 = const (); // scope 1 at $DIR/asm_unwind_panic_abort.rs:13:9: 13:49
12+
asm!("", options(MAY_UNWIND)) -> [return: bb1, unwind: bb2]; // scope 1 at $DIR/asm_unwind_panic_abort.rs:13:9: 13:49
13+
}
14+
15+
bb1: {
16+
StorageDead(_1); // scope 1 at $DIR/asm_unwind_panic_abort.rs:13:48: 13:49
17+
_0 = const (); // scope 1 at $DIR/asm_unwind_panic_abort.rs:12:5: 14:6
18+
return; // scope 0 at $DIR/asm_unwind_panic_abort.rs:15:2: 15:2
19+
}
20+
21+
bb2 (cleanup): {
22+
abort; // scope 0 at $DIR/asm_unwind_panic_abort.rs:11:1: 15:2
23+
}
24+
}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//! Tests that unwinding from an asm block is caught and forced to abort
2+
//! when `-C panic=abort`.
3+
4+
// min-llvm-version: 13.0.0
5+
// compile-flags: -C panic=abort
6+
// no-prefer-dynamic
7+
8+
#![feature(asm_unwind)]
9+
10+
// EMIT_MIR asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir
11+
fn main() {
12+
unsafe {
13+
std::arch::asm!("", options(may_unwind));
14+
}
15+
}

0 commit comments

Comments
 (0)