https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107282

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
So we are late processing (rest_of_handle_final) dwaf2out_decl of copyLifeState
and there iterating the scope vars which include a TYPE_DECL ._anon_2 here
for which we generate a type DIE because

27023         if (is_redundant_typedef (decl))
27024           gen_type_die (TREE_TYPE (decl), context_die);

but the type was already generated early and there will be no way to
refer to just the type late (or TYPE_DECLs in practice from LTO).

diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index e81044b8c48..090465a4896 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -27021,7 +27021,10 @@ gen_decl_die (tree decl, tree origin, struct
vlr_context *ctx,
        break;

       if (is_redundant_typedef (decl))
-       gen_type_die (TREE_TYPE (decl), context_die);
+       {
+         if (early_dwarf)
+           gen_type_die (TREE_TYPE (decl), context_die);
+       }
       else
        /* Output a DIE to represent the typedef itself.  */
        gen_typedef_die (decl, context_die);

fixes this, but I'm not sure it isn't barking up the wrong tree given
the bisection - but that should only end up emitting more debug early
and not affect what we do late.

Reply via email to