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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
So we're creating a template value attribute at late finish time from

(gdb) p debug_generic_expr (e->arg)
{.__pfn=isClassMethod, .__delta=0}

as

(symbol_ref/i:DI ("_ZNK14ObjCMethodDecl13isClassMethodEv") [flags 0x3]
<function_decl 0x7ffff69ec200 isClassMethod>)

and register it with .debug_addr in new_addr_loc_descr.

resolve_addr should now prune that immediately again because the function
hasn't been output.  _But_ the pending template value attribute was added
to a removed die (the type die).

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c     (revision 251374)
+++ gcc/dwarf2out.c     (working copy)
@@ -26037,7 +26037,8 @@ gen_remaining_tmpl_value_param_die_attri
       j = 0;
       FOR_EACH_VEC_ELT (*tmpl_value_parm_die_table, i, e)
        {
-         if (!tree_add_const_value_attribute (e->die, e->arg))
+         if (!e->die->removed
+             && !tree_add_const_value_attribute (e->die, e->arg))
            {
              dw_loc_descr_ref loc = NULL;
              if (! early_dwarf

should avoid useless work and this issue.

Reply via email to