stage2: Fix assertion in struct field offset when all fields are 0-size

This commit is contained in:
Cody Tapscott
2022-03-11 14:19:45 -07:00
committed by Andrew Kelley
parent 34a6fcd88e
commit 54426bdc82

View File

@@ -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;
},