Don't crash when local variables are too big to store on the stack

This commit is contained in:
bjorn3 2022-07-22 18:03:24 +00:00
parent 5fcedf62df
commit cd96988436

View File

@ -324,6 +324,12 @@ impl<'tcx> CPlace<'tcx> {
};
}
if layout.size.bytes() >= u64::from(u32::MAX - 16) {
fx.tcx
.sess
.fatal(&format!("values of type {} are too big to store on the stack", layout.ty));
}
let stack_slot = fx.bcx.create_stack_slot(StackSlotData {
kind: StackSlotKind::ExplicitSlot,
// FIXME Don't force the size to a multiple of 16 bytes once Cranelift gets a way to