Skip to content

Commit d5ccf68

Browse files
committed
fix mplace_access_checked with forced alignment
1 parent 563ab4a commit d5ccf68

File tree

1 file changed

+3
-2
lines changed
  • compiler/rustc_mir/src/interpret

1 file changed

+3
-2
lines changed

compiler/rustc_mir/src/interpret/place.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,9 @@ where
374374
.size_and_align_of_mplace(&place)?
375375
.unwrap_or((place.layout.size, place.layout.align.abi));
376376
assert!(place.mplace.align <= align, "dynamic alignment less strict than static one?");
377-
// Check (stricter) dynamic alignment, unless forced otherwise.
378-
place.mplace.align = force_align.unwrap_or(align);
377+
let align = force_align.unwrap_or(align);
378+
// Record new (stricter, unless forced) alignment requirement in place.
379+
place.mplace.align = align;
379380
// When dereferencing a pointer, it must be non-null, aligned, and live.
380381
if let Some(ptr) = self.memory.check_ptr_access(place.ptr, size, align)? {
381382
place.mplace.ptr = ptr.into();

0 commit comments

Comments
 (0)