@@ -27,9 +27,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
2727 }
2828 // There are some more lang items we want to hook that CTFE does not hook (yet).
2929 if this. tcx . lang_items ( ) . align_offset_fn ( ) == Some ( instance. def . def_id ( ) ) {
30- let n = this. align_offset ( args[ 0 ] , args[ 1 ] ) ?;
3130 let dest = dest. unwrap ( ) ;
32- let n = this. truncate ( n , dest. layout ) ;
31+ let n = this. align_offset ( args [ 0 ] , args [ 1 ] , dest. layout ) ? ;
3332 this. write_scalar ( Scalar :: from_uint ( n, dest. layout . size ) , dest) ?;
3433 this. goto_block ( ret) ?;
3534 return Ok ( None ) ;
@@ -51,7 +50,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
5150 fn align_offset (
5251 & mut self ,
5352 ptr_op : OpTy < ' tcx , Tag > ,
54- align_op : OpTy < ' tcx , Tag >
53+ align_op : OpTy < ' tcx , Tag > ,
54+ layout : ty:: layout:: TyLayout < ' tcx > ,
5555 ) -> InterpResult < ' tcx , u128 > {
5656 let this = self . eval_context_mut ( ) ;
5757
@@ -65,7 +65,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
6565 if let Scalar :: Ptr ( ptr) = ptr_scalar {
6666 let cur_align = this. memory ( ) . get ( ptr. alloc_id ) ?. align . bytes ( ) as usize ;
6767 if cur_align < req_align {
68- return Ok ( u128:: max_value ( ) ) ;
68+ return Ok ( this . truncate ( u128:: max_value ( ) , layout ) ) ;
6969 }
7070 }
7171
0 commit comments