Commit 4b14384989
Changed files (2)
src
arch
aarch64
x86_64
src/arch/aarch64/CodeGen.zig
@@ -786,6 +786,11 @@ fn allocMem(self: *Self, inst: Air.Inst.Index, abi_size: u32, abi_align: u32) !u
/// Use a pointer instruction as the basis for allocating stack memory.
fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 {
const elem_ty = self.air.typeOfIndex(inst).elemType();
+
+ if (!elem_ty.hasRuntimeBits()) {
+ return self.allocMem(inst, @sizeOf(usize), @alignOf(usize));
+ }
+
const abi_size = math.cast(u32, elem_ty.abiSize(self.target.*)) catch {
return self.fail("type '{}' too big to fit into stack frame", .{elem_ty});
};
src/arch/x86_64/CodeGen.zig
@@ -852,7 +852,7 @@ fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 {
const elem_ty = ptr_ty.elemType();
if (!elem_ty.hasRuntimeBits()) {
- return self.allocMem(inst, 8, 8);
+ return self.allocMem(inst, @sizeOf(usize), @alignOf(usize));
}
const abi_size = math.cast(u32, elem_ty.abiSize(self.target.*)) catch {