va_arg: fix potential misaligned load

This commit is contained in:
Folkert de Vries
2026-02-13 14:09:26 +01:00
parent 93637f398f
commit 0169aaea31
+2 -1
View File
@@ -69,7 +69,8 @@ fn emit_direct_ptr_va_arg<'ll, 'tcx>(
{
let adjusted_size = bx.cx().const_i32((slot_size.bytes() - size.bytes()) as i32);
let adjusted = bx.inbounds_ptradd(addr, adjusted_size);
(adjusted, addr_align)
// We're in the middle of a slot now, so use the type's alignment, not the slot's.
(adjusted, align)
} else {
(addr, addr_align)
}