@@ -16,6 +16,7 @@ pub mod tls;
16
16
use log:: trace;
17
17
18
18
use rustc_middle:: { mir, ty} ;
19
+ use rustc_target:: spec:: abi:: Abi ;
19
20
20
21
use crate :: * ;
21
22
use helpers:: check_arg_count;
@@ -25,6 +26,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
25
26
fn find_mir_or_eval_fn (
26
27
& mut self ,
27
28
instance : ty:: Instance < ' tcx > ,
29
+ abi : Abi ,
28
30
args : & [ OpTy < ' tcx , Tag > ] ,
29
31
ret : Option < ( PlaceTy < ' tcx , Tag > , mir:: BasicBlock ) > ,
30
32
unwind : Option < mir:: BasicBlock > ,
@@ -40,6 +42,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
40
42
}
41
43
}
42
44
45
+ if abi != Abi :: C {
46
+ throw_ub_format ! ( "calling a function with ABI {:?} using ABI {:?}" , Abi :: C , abi)
47
+ }
48
+
43
49
// Try to see if we can do something about foreign items.
44
50
if this. tcx . is_foreign_item ( instance. def_id ( ) ) {
45
51
// An external function call that does not have a MIR body. We either find MIR elsewhere
@@ -72,8 +78,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
72
78
return Ok ( false ) ;
73
79
}
74
80
75
- let req_align = this
76
- . force_bits ( this. read_scalar ( align_op) ?. check_init ( ) ?, this. pointer_size ( ) ) ?;
81
+ let req_align =
82
+ this . force_bits ( this. read_scalar ( align_op) ?. check_init ( ) ?, this. pointer_size ( ) ) ?;
77
83
78
84
// Stop if the alignment is not a power of two.
79
85
if !req_align. is_power_of_two ( ) {
0 commit comments