Skip to content

Commit e46aab5

Browse files
author
hyd-dev
committed
Use check_shim() for abort
1 parent c822ec5 commit e46aab5

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/shims/foreign_items.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
244244
throw_machine_stop!(TerminationInfo::Exit(code.into()));
245245
}
246246
"abort" => {
247-
this.check_abi_and_shim_symbol_clash(
248-
abi,
249-
Abi::C { unwind: false },
250-
link_name_sym,
251-
)?;
247+
let &[] =
248+
this.check_shim(abi, Abi::C { unwind: false }, link_name_sym, args)?;
252249
throw_machine_stop!(TerminationInfo::Abort(
253250
"the program aborted execution".to_owned()
254251
))
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
fn main() {
2+
extern "C" {
3+
fn abort(_: i32) -> !;
4+
}
5+
6+
unsafe {
7+
abort(1);
8+
//~^ ERROR Undefined Behavior: incorrect number of arguments: got 1, expected 0
9+
}
10+
}

0 commit comments

Comments
 (0)