Skip to content

Commit af7f53d

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

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-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:12:11: 12:11
5+
let _1: (); // in scope 0 at $DIR/asm_unwind_panic_abort.rs:14:9: 14:49
6+
scope 1 {
7+
}
8+
9+
bb0: {
10+
StorageLive(_1); // scope 1 at $DIR/asm_unwind_panic_abort.rs:14:9: 14:49
11+
_1 = const (); // scope 1 at $DIR/asm_unwind_panic_abort.rs:14:9: 14:49
12+
asm!("", options(MAY_UNWIND)) -> [return: bb1, unwind: bb2]; // scope 1 at $DIR/asm_unwind_panic_abort.rs:14:9: 14:49
13+
}
14+
15+
bb1: {
16+
StorageDead(_1); // scope 1 at $DIR/asm_unwind_panic_abort.rs:14:48: 14:49
17+
_0 = const (); // scope 1 at $DIR/asm_unwind_panic_abort.rs:13:5: 15:6
18+
return; // scope 0 at $DIR/asm_unwind_panic_abort.rs:16:2: 16:2
19+
}
20+
21+
bb2 (cleanup): {
22+
abort; // scope 0 at $DIR/asm_unwind_panic_abort.rs:12:1: 16:2
23+
}
24+
}

Diff for: src/test/mir-opt/asm_unwind_panic_abort.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
// only-x86_64
6+
// compile-flags: -C panic=abort
7+
// no-prefer-dynamic
8+
9+
#![feature(asm_unwind)]
10+
11+
// EMIT_MIR asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir
12+
fn main() {
13+
unsafe {
14+
std::arch::asm!("", options(may_unwind));
15+
}
16+
}

0 commit comments

Comments
 (0)