authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2025-07-19 13:54:31-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-07-20 03:29:25+02:00
log592f1043dc704faf79bde7149917d4155b3747f8
treee56ff6a9a88e67c78e3647f1205b3a4c4b18551a
parenta0d16829215f56fe42548f1014cba0f2df5a1609

cbe: fix comptime-known packed unions


1 files changed, 4 insertions(+), 1 deletions(-)

src/codegen/c.zig+4-1
...@@ -2438,7 +2438,10 @@ pub const DeclGen = struct {...@@ -2438,7 +2438,10 @@ pub const DeclGen = struct {
2438 const ty = val.typeOf(zcu);2438 const ty = val.typeOf(zcu);
2439 return .{ .data = .{2439 return .{ .data = .{
2440 .dg = dg,2440 .dg = dg,
2441 .int_info = ty.intInfo(zcu),2441 .int_info = if (ty.zigTypeTag(zcu) == .@"union" and ty.containerLayout(zcu) == .@"packed")
2442 .{ .signedness = .unsigned, .bits = @intCast(ty.bitSize(zcu)) }
2443 else
2444 ty.intInfo(zcu),
2442 .kind = kind,2445 .kind = kind,
2443 .ctype = try dg.ctypeFromType(ty, kind),2446 .ctype = try dg.ctypeFromType(ty, kind),
2444 .val = val,2447 .val = val,