@@ -333,7 +333,7 @@ where
333
333
let val = self . read_immediate ( src) ?;
334
334
trace ! ( "deref to {} on {:?}" , val. layout. ty, * val) ;
335
335
let place = self . ref_to_mplace ( val) ?;
336
- self . mplace_access_checked ( place)
336
+ self . mplace_access_checked ( place, None )
337
337
}
338
338
339
339
/// Check if the given place is good for memory access with the given
@@ -361,12 +361,14 @@ where
361
361
pub fn mplace_access_checked (
362
362
& self ,
363
363
mut place : MPlaceTy < ' tcx , M :: PointerTag > ,
364
+ force_align : Option < Align > ,
364
365
) -> InterpResult < ' tcx , MPlaceTy < ' tcx , M :: PointerTag > > {
365
366
let ( size, align) = self
366
367
. size_and_align_of_mplace ( place) ?
367
368
. unwrap_or ( ( place. layout . size , place. layout . align . abi ) ) ;
368
369
assert ! ( place. mplace. align <= align, "dynamic alignment less strict than static one?" ) ;
369
- place. mplace . align = align; // maximally strict checking
370
+ // Check (stricter) dynamic alignment, unless forced otherwise.
371
+ place. mplace . align = force_align. unwrap_or ( align) ;
370
372
// When dereferencing a pointer, it must be non-NULL, aligned, and live.
371
373
if let Some ( ptr) = self . check_mplace_access ( place, Some ( size) ) ? {
372
374
place. mplace . ptr = ptr. into ( ) ;
0 commit comments