Skip to content

Commit

Permalink
Fix handling of large alignments in write_cvalue_maybe_transmute (r…
Browse files Browse the repository at this point in the history
  • Loading branch information
beetrees authored Jul 21, 2024
1 parent b70ad2d commit 4fb3c4b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/value_and_place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,8 +677,10 @@ impl<'tcx> CPlace<'tcx> {
let to_addr = to_ptr.get_addr(fx);
let src_layout = from.1;
let size = dst_layout.size.bytes();
let src_align = src_layout.align.abi.bytes() as u8;
let dst_align = dst_layout.align.abi.bytes() as u8;
// `emit_small_memory_copy` uses `u8` for alignments, just use the maximum
// alignment that fits in a `u8` if the actual alignment is larger.
let src_align = src_layout.align.abi.bytes().try_into().unwrap_or(128);
let dst_align = dst_layout.align.abi.bytes().try_into().unwrap_or(128);
fx.bcx.emit_small_memory_copy(
fx.target_config,
to_addr,
Expand Down

0 comments on commit 4fb3c4b

Please sign in to comment.