aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
authorCody Tapscott <topolarity@tapscott.me>2022-10-10 23:57:48 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-10-11 15:42:01 -0400
commite6ebdcb82ed9fd226ef18670115b8b2617c0a392 (patch)
tree1015c798799df19173c85908dec4a0e2c63adbb0 /src/codegen
parent8635c18e4091bd3034121ca98439bf40bce72324 (diff)
downloadzig-e6ebdcb82ed9fd226ef18670115b8b2617c0a392.tar.gz
zig-e6ebdcb82ed9fd226ef18670115b8b2617c0a392.zip
stage2 LLVM: Use a packed aggregate for union payload init
Without the packed qualifier, the type layout that we use to initialize doesn't match the correct layout of the underlying storage, causing corrupted data and past-the-end writes.
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/llvm.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index a24c14c9c6..300a24280a 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -8897,7 +8897,7 @@ pub const FuncGen = struct {
return union_llvm_ty.constInt(tag_int, .False);
}
assert(isByRef(union_ty));
- // The llvm type of the alloca will the the named LLVM union type, which will not
+ // The llvm type of the alloca will be the named LLVM union type, and will not
// necessarily match the format that we need, depending on which tag is active. We
// must construct the correct unnamed struct type here and bitcast, in order to
// then set the fields appropriately.
@@ -8922,7 +8922,7 @@ pub const FuncGen = struct {
const fields: [2]*llvm.Type = .{
field_llvm_ty, self.context.intType(8).arrayType(padding_len),
};
- break :p self.context.structType(&fields, fields.len, .False);
+ break :p self.context.structType(&fields, fields.len, .True);
};
if (layout.tag_size == 0) {
const fields: [1]*llvm.Type = .{payload};