On Tue, 29 Aug 2017, Richard Biener wrote:

> 
> The following avoids adding DW_AT_inline attributes twice on which
> dsymutil complains.  The duplicate attribute is caused by stray
> code I left in (I guess I hoped nothing ends up DECL_ABSTRACT_P ...).
> Thus the following patch removes it -- DW_AT_inline is solely set
> by dwarf2out_abstract_function now.
> 
> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.  The
> gdb testsuite shows no regression.
> 
> Will commit once testing finished.
> 
> Note the assert is deliberately restricted to DW_AT_inline for now
> given enabling it unconditionally fires left and right ... :/
> (sth to fix, but only as followups)

The following seems to cure it as far as preliminary testing goes.

Full bootstrap & regtest currently running on x86_64-unknown-linux-gnu.

Will apply once it succeeds.

Richard.

2017-08-29  Richard Biener  <rguent...@suse.de>

        * dwarf2out.c (add_dwarf_attr): Check we don't add duplicate
        attributes.
        (gen_subprogram_die): Add DW_AT_object_pointer only early.
        (dwarf2out_early_global_decl): Only generate a DIE for the
        abstract origin if it doesn't already exist.
        (resolve_addr): Do not add the linkage name twice when
        generating a stub DIE for the DW_TAG_GNU_call_site target.

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c     (revision 251409)
+++ gcc/dwarf2out.c     (working copy)
@@ -4129,7 +4129,7 @@ add_dwarf_attr (dw_die_ref die, dw_attr_
       dw_attr_node *a;
       unsigned ix;
       FOR_EACH_VEC_SAFE_ELT (die->die_attr, ix, a)
-       gcc_assert (a->dw_attr != attr->dw_attr || a->dw_attr != DW_AT_inline);
+       gcc_assert (a->dw_attr != attr->dw_attr);
     }
 
   vec_safe_reserve (die->die_attr, 1);
@@ -22334,7 +22334,8 @@ gen_subprogram_die (tree decl, dw_die_re
            {
              dw_die_ref parm_die = gen_decl_die (parm, NULL, NULL, subr_die);
 
-             if (parm == DECL_ARGUMENTS (decl)
+             if (early_dwarf
+                 && parm == DECL_ARGUMENTS (decl)
                  && TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE
                  && parm_die
                  && (dwarf_version >= 3 || !dwarf_strict))
@@ -25479,10 +25480,11 @@ dwarf2out_early_global_decl (tree decl)
             with C++ constructor clones for example and makes
             dwarf2out_abstract_function happy which requires the early
             DIE of the abstract instance to be present.  */
-         if (DECL_ABSTRACT_ORIGIN (decl))
+         tree origin = DECL_ABSTRACT_ORIGIN (decl);
+         if (origin != NULL && lookup_decl_die (origin) == NULL)
            {
-             current_function_decl = DECL_ABSTRACT_ORIGIN (decl);
-             dwarf2out_decl (DECL_ABSTRACT_ORIGIN (decl));
+             current_function_decl = origin;
+             dwarf2out_decl (origin);
            }
 
          current_function_decl = decl;
@@ -29047,7 +29049,7 @@ resolve_addr (dw_die_ref die)
                    add_AT_flag (tdie, DW_AT_external, 1);
                    add_AT_flag (tdie, DW_AT_declaration, 1);
                    add_linkage_attr (tdie, tdecl);
-                   add_name_and_src_coords_attributes (tdie, tdecl);
+                   add_name_and_src_coords_attributes (tdie, tdecl, true);
                    equate_decl_number_to_die (tdecl, tdie);
                  }
              }

Reply via email to