File tree 1 file changed +10
-1
lines changed
src/librustc_mir/interpret 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -304,7 +304,16 @@ where
304
304
) -> InterpResult < ' tcx , MPlaceTy < ' tcx , M :: PointerTag > > {
305
305
let val = self . read_immediate ( src) ?;
306
306
trace ! ( "deref to {} on {:?}" , val. layout. ty, * val) ;
307
- self . ref_to_mplace ( val)
307
+ let mut place = self . ref_to_mplace ( val) ?;
308
+ let ( size, align) = self . size_and_align_of_mplace ( place) ?
309
+ . unwrap_or ( ( place. layout . size , place. layout . align . abi ) ) ;
310
+ assert ! ( place. mplace. align <= align, "dynamic alignment less strict than static one?" ) ;
311
+ place. mplace . align = align; // maximally strict checking
312
+ // When dereferencing a pointer, it must be non-NULL, aligned, and live.
313
+ if let Some ( ptr) = self . check_mplace_access ( place, Some ( size) ) ? {
314
+ place. mplace . ptr = ptr. into ( ) ;
315
+ }
316
+ Ok ( place)
308
317
}
309
318
310
319
/// Check if the given place is good for memory access with the given
You can’t perform that action at this time.
0 commit comments