From abc30f79489b68f6dc0ee4b408c63a8e783215d1 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 20 Sep 2021 16:48:42 -0700 Subject: stage2: improve handling of 0 bit types * Sema: zirAtomicLoad handles 0-bit types correctly * LLVM backend: when lowering function types, elide parameters with 0-bit types. * Type: abiSize handles u0/i0 correctly --- src/type.zig | 1 + 1 file changed, 1 insertion(+) (limited to 'src/type.zig') diff --git a/src/type.zig b/src/type.zig index 122faefbc7..c2dc150347 100644 --- a/src/type.zig +++ b/src/type.zig @@ -1822,6 +1822,7 @@ pub const Type = extern union { .int_signed, .int_unsigned => { const bits: u16 = self.cast(Payload.Bits).?.data; + if (bits == 0) return 0; return std.math.ceilPowerOfTwoPromote(u16, (bits + 7) / 8); }, -- cgit v1.2.3