authorgravatar for topolarity@tapscott.meCody Tapscott <topolarity@tapscott.me> 2022-11-01 08:45:33-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-11-02 14:11:00-07:00
logf354ad638aa7baf74a246723b7fcb01164cabbbd
treeb2ec7ff597aebe91d12c80377b94acf2ef01cb56
parent99b1eaaac47567727f2ac76c9243dd7311177a5e

stage2 llvm: Respect alignment for `.union_init`

Resolves #13232.

1 files changed, 1 insertions(+), 1 deletions(-)

src/codegen/llvm.zig+1-1
...@@ -9150,7 +9150,7 @@ pub const FuncGen = struct {...@@ -9150,7 +9150,7 @@ pub const FuncGen = struct {
9150 // necessarily match the format that we need, depending on which tag is active. We9150 // necessarily match the format that we need, depending on which tag is active. We
9151 // must construct the correct unnamed struct type here and bitcast, in order to9151 // must construct the correct unnamed struct type here and bitcast, in order to
9152 // then set the fields appropriately.9152 // then set the fields appropriately.
9153 const result_ptr = self.buildAlloca(union_llvm_ty, null);9153 const result_ptr = self.buildAlloca(union_llvm_ty, layout.abi_align);
9154 const llvm_payload = try self.resolveInst(extra.init);9154 const llvm_payload = try self.resolveInst(extra.init);
9155 assert(union_obj.haveFieldTypes());9155 assert(union_obj.haveFieldTypes());
9156 const field = union_obj.fields.values()[extra.field_index];9156 const field = union_obj.fields.values()[extra.field_index];