authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-08-13 12:21:06+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-08-13 23:52:40+01:00
log3736aac77868b867e0d529a3c393069537836451
tree9c795a396dbbc13bca2043758f3f6b9fbd1e1d6b
parente304a478c0654e8a6c506eedbd5556f99ac79d6c

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

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

src/link/Dwarf.zig+2-2
...@@ -3241,7 +3241,7 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo...@@ -3241,7 +3241,7 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo
3241 const field_type: Type = .fromInterned(loaded_union.field_types.get(ip)[field_index]);3241 const field_type: Type = .fromInterned(loaded_union.field_types.get(ip)[field_index]);
3242 try wip_nav.refType(field_type);3242 try wip_nav.refType(field_type);
3243 try diw.writeUleb128(loaded_union.fieldAlign(ip, field_index).toByteUnits() orelse3243 try diw.writeUleb128(loaded_union.fieldAlign(ip, field_index).toByteUnits() orelse
3244 field_type.abiAlignment(zcu).toByteUnits().?);3244 if (field_type.isNoReturn(zcu)) 1 else field_type.abiAlignment(zcu).toByteUnits().?);
3245 }3245 }
3246 try diw.writeUleb128(@intFromEnum(AbbrevCode.null));3246 try diw.writeUleb128(@intFromEnum(AbbrevCode.null));
3247 break :tag .done;3247 break :tag .done;
...@@ -4599,7 +4599,7 @@ fn updateContainerTypeWriterError(...@@ -4599,7 +4599,7 @@ fn updateContainerTypeWriterError(
4599 const field_type: Type = .fromInterned(loaded_union.field_types.get(ip)[field_index]);4599 const field_type: Type = .fromInterned(loaded_union.field_types.get(ip)[field_index]);
4600 try wip_nav.refType(field_type);4600 try wip_nav.refType(field_type);
4601 try diw.writeUleb128(loaded_union.fieldAlign(ip, field_index).toByteUnits() orelse4601 try diw.writeUleb128(loaded_union.fieldAlign(ip, field_index).toByteUnits() orelse
4602 field_type.abiAlignment(zcu).toByteUnits().?);4602 if (field_type.isNoReturn(zcu)) 1 else field_type.abiAlignment(zcu).toByteUnits().?);
4603 }4603 }
4604 if (loaded_union.field_types.len > 0) try diw.writeUleb128(@intFromEnum(AbbrevCode.null));4604 if (loaded_union.field_types.len > 0) try diw.writeUleb128(@intFromEnum(AbbrevCode.null));
4605 },4605 },