aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
diff options
context:
space:
mode:
authorCody Tapscott <topolarity@tapscott.me>2022-03-11 14:19:45 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-03-14 21:42:42 -0700
commit54426bdc82ad361bb580f9678dd23417c350282a (patch)
tree7bdccf81b411acdc0ffad5e5f585e865e6b7280c /src/type.zig
parent34a6fcd88e20a2491bf6a5396d583a7449cac20b (diff)
downloadzig-54426bdc82ad361bb580f9678dd23417c350282a.tar.gz
zig-54426bdc82ad361bb580f9678dd23417c350282a.zip
stage2: Fix assertion in struct field offset when all fields are 0-size
Diffstat (limited to 'src/type.zig')
-rw-r--r--src/type.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/type.zig b/src/type.zig
index 9ea579ee19..b36f480654 100644
--- a/src/type.zig
+++ b/src/type.zig
@@ -4786,7 +4786,7 @@ pub const Type = extern union {
return field_offset.offset;
}
- return std.mem.alignForwardGeneric(u64, it.offset, it.big_align);
+ return std.mem.alignForwardGeneric(u64, it.offset, @maximum(it.big_align, 1));
},
.tuple, .anon_struct => {
@@ -4809,7 +4809,7 @@ pub const Type = extern union {
if (i == index) return offset;
offset += field_ty.abiSize(target);
}
- offset = std.mem.alignForwardGeneric(u64, offset, big_align);
+ offset = std.mem.alignForwardGeneric(u64, offset, @maximum(big_align, 1));
return offset;
},