Skip to content

Commit 5d97cbf

Browse files
committed
va_arg: fix potential misaligned load
1 parent 70c7d01 commit 5d97cbf

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

compiler/rustc_codegen_llvm/src/va_arg.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ fn emit_direct_ptr_va_arg<'ll, 'tcx>(
6868
{
6969
let adjusted_size = bx.cx().const_i32((slot_size.bytes() - size.bytes()) as i32);
7070
let adjusted = bx.inbounds_ptradd(addr, adjusted_size);
71-
(adjusted, addr_align)
71+
// We're in the middle of a slot now, so use the type's alignment, not the slot's.
72+
(adjusted, align)
7273
} else {
7374
(addr, addr_align)
7475
}

0 commit comments

Comments
 (0)