https://gcc.gnu.org/g:0a9b788f27514fe72c539de8a58f6d6cb6e2e97f
commit 0a9b788f27514fe72c539de8a58f6d6cb6e2e97f Author: Alexandre Oliva <ol...@adacore.com> Date: Fri Jun 28 08:13:52 2024 -0300 [dwarf] get_debug_type of TYPE_NAME to compare with 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 follow debug type for the TYPE_NAME decl type in modified_type_die. for gcc/ChangeLog * dwarf2out.cc (modified_type_die): Follow name's debug type. Diff: --- gcc/dwarf2out.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index f463435e446..5ce1a3e6f66 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -14051,8 +14051,11 @@ modified_type_die (tree type, int cv_quals, bool reverse, && (qualified_type == TYPE_MAIN_VARIANT (type) || (cv_quals == TYPE_UNQUALIFIED))) || (TREE_CODE (name) == TYPE_DECL - && TREE_TYPE (name) == qualified_type - && DECL_NAME (name)))) + && DECL_NAME (name) + && (TREE_TYPE (name) == qualified_type + || (lang_hooks.types.get_debug_type + && (lang_hooks.types.get_debug_type (TREE_TYPE (name)) + == qualified_type)))))) { if (TREE_CODE (name) == TYPE_DECL) /* Could just call add_name_and_src_coords_attributes here,