https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90232
--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> --- With this demonstrator patch: ... diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index b9a624e1ac7..1e818973fae 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -8400,10 +8400,11 @@ generate_skeleton (dw_die_ref die) /* If this type definition is nested inside another type, and is not an instantiation of a template, always leave at least a declaration in its place. */ - if (die->die_parent != NULL - && is_type_die (die->die_parent) - && !is_template_instantiation (die)) - node.new_die = clone_as_declaration (die); + if (true || (die->die_parent != NULL + && is_type_die (die->die_parent) + && !is_template_instantiation (die))) + node.new_die = clone_as_declaration (die); + node.new_die->die_perennial_p = 1; generate_skeleton_bottom_up (&node); return node.new_die; ... instead we get the desired: ... <0><d2>: Abbrev Number: 5 (DW_TAG_compile_unit) <d8> DW_AT_name : (indirect string, offset: 0x1f8): 36.c <1><f4>: Abbrev Number: 6 (DW_TAG_structure_type) <f5> DW_AT_name : s <f7> DW_AT_signature : signature: 0xfd1462823bb6f7b7 <1><106>: Abbrev Number: 7 (DW_TAG_subprogram) <107> DW_AT_name : (indirect string, offset: 0x2b8): main <2><124>: Abbrev Number: 8 (DW_TAG_variable) <125> DW_AT_name : a <12a> DW_AT_type : <0xf4> Contents of the .debug_types section: Signature: 0xfd1462823bb6f7b7 <1><1d>: Abbrev Number: 2 (DW_TAG_structure_type) <1e> DW_AT_name : s ... and: ... <0><13e>: Abbrev Number: 5 (DW_TAG_compile_unit) <144> DW_AT_name : (indirect string, offset: 0x2bd): 36b.c <1><160>: Abbrev Number: 6 (DW_TAG_structure_type) <161> DW_AT_name : s <163> DW_AT_signature : signature: 0x534310fbefba324d <1><172>: Abbrev Number: 7 (DW_TAG_subprogram) <173> DW_AT_name : f <2><18a>: Abbrev Number: 8 (DW_TAG_variable) <18b> DW_AT_name : b Contents of the .debug_types section: Signature: 0x534310fbefba324d <1><59>: Abbrev Number: 2 (DW_TAG_structure_type) <5a> DW_AT_name : s ...