Correctly align returned addr for to_addr on NoPlace

This commit is contained in:
bjorn3 2019-11-24 14:56:51 +01:00
parent fc826a7525
commit 4a8b0ca274

View File

@ -334,7 +334,15 @@ impl<'tcx> CPlace<'tcx> {
fx.bcx.ins().stack_addr(fx.pointer_type, stack_slot, 0),
None,
),
CPlaceInner::NoPlace => (fx.bcx.ins().iconst(fx.pointer_type, 45), None),
CPlaceInner::NoPlace => {
(
fx.bcx.ins().iconst(
fx.pointer_type,
i64::try_from(self.layout.align.pref.bytes()).unwrap(),
),
None
)
}
CPlaceInner::Var(_) => bug!("Expected CPlace::Addr, found CPlace::Var"),
}
}