From 54426bdc82ad361bb580f9678dd23417c350282a Mon Sep 17 00:00:00 2001 From: Cody Tapscott Date: Fri, 11 Mar 2022 14:19:45 -0700 Subject: [PATCH] stage2: Fix assertion in struct field offset when all fields are 0-size --- src/type.zig | 4 ++-- 1 file 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; },