https://gcc.gnu.org/g:0aa14458da76fdbb55e77b0ed5b8069fe57ed56d
commit 0aa14458da76fdbb55e77b0ed5b8069fe57ed56d Author: Alexandre Oliva <ol...@adacore.com> Date: Fri Jun 28 08:13:52 2024 -0300 [dwarf] get_debug_type of qualified_type When we choose the narrower/packed variant of a type as the main debug info type, we fail to output its name if we fail to advance qualified_type to the main debug type in modified_type_die. for gcc/ChangeLog * dwarf2out.cc (modified_type_die): Take qualified_type's debug type. Diff: --- gcc/dwarf2out.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index f463435e446..bf5faffb700 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -13758,6 +13758,13 @@ modified_type_die (tree type, int cv_quals, bool reverse, /* If we do, then we can just use its DIE, if it exists. */ if (qualified_type) { + if (lang_hooks.types.get_debug_type) + { + tree debug_type = lang_hooks.types.get_debug_type (qualified_type); + if (debug_type != NULL) + qualified_type = debug_type; + } + mod_type_die = lookup_type_die (qualified_type); /* DW_AT_endianity doesn't come from a qualifier on the type, so it is