Skip to content

Commit 15465a5

Browse files
committed
don't ICE when we unwind despite panic=abort
1 parent c9ff02f commit 15465a5

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/shims/panic.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
4545

4646
trace!("miri_start_panic: {:?}", this.frame().instance);
4747
// Make sure we only start unwinding when this matches our panic strategy.
48-
assert_eq!(this.tcx.sess.panic_strategy(), PanicStrategy::Unwind);
48+
if this.tcx.sess.panic_strategy() != PanicStrategy::Unwind {
49+
throw_ub_format!("unwinding despite panic=abort");
50+
}
4951

5052
// Get the raw pointer stored in arg[0] (the panic payload).
5153
let &[ref payload] = check_arg_count(args)?;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// compile-flags: -Cpanic=abort
2+
3+
//! Unwinding despite `-C panic=abort` is an error.
4+
5+
extern "Rust" {
6+
fn miri_start_panic(payload: *mut u8) -> !;
7+
}
8+
9+
fn main() {
10+
unsafe { miri_start_panic(&mut 0); } //~ ERROR unwinding despite panic=abort
11+
}

0 commit comments

Comments
 (0)