From 3736aac77868b867e0d529a3c393069537836451 Mon Sep 17 00:00:00 2001 From: mlugg Date: Wed, 13 Aug 2025 12:21:06 +0100 Subject: [PATCH] Dwarf: handle noreturn union fields in more places A little clunky -- maybe the frontend should give an answer here -- but this patch makes sense with the surrounding logic just to fix the crash. Resolves: #24265 --- src/link/Dwarf.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/link/Dwarf.zig b/src/link/Dwarf.zig index c5b35f5362c32c40803ff3cfe0902a8e0f079358..70b4eab1ae2b9760f0314c5fe4865ed714e75639 100644 --- a/src/link/Dwarf.zig +++ b/src/link/Dwarf.zig @@ -3241,7 +3241,7 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo const field_type: Type = .fromInterned(loaded_union.field_types.get(ip)[field_index]); try wip_nav.refType(field_type); try diw.writeUleb128(loaded_union.fieldAlign(ip, field_index).toByteUnits() orelse - field_type.abiAlignment(zcu).toByteUnits().?); + if (field_type.isNoReturn(zcu)) 1 else field_type.abiAlignment(zcu).toByteUnits().?); } try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); break :tag .done; @@ -4599,7 +4599,7 @@ fn updateContainerTypeWriterError( const field_type: Type = .fromInterned(loaded_union.field_types.get(ip)[field_index]); try wip_nav.refType(field_type); try diw.writeUleb128(loaded_union.fieldAlign(ip, field_index).toByteUnits() orelse - field_type.abiAlignment(zcu).toByteUnits().?); + if (field_type.isNoReturn(zcu)) 1 else field_type.abiAlignment(zcu).toByteUnits().?); } if (loaded_union.field_types.len > 0) try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); }, -- 2.54.0