[Bug debug/97060] Missing DW_AT_declaration=1 in dwarf data

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Sep 16 08:55:24 GMT 2020


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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So perhaps completely untested:
--- gcc/dwarf2out.c.jj  2020-09-07 13:17:58.383594248 +0200
+++ gcc/dwarf2out.c     2020-09-16 10:53:44.353632197 +0200
@@ -26547,7 +26547,8 @@ dwarf2out_early_global_decl (tree decl)
              && ((origin_die = lookup_decl_die (origin)) == NULL
                  || is_declaration_die (origin_die)))
            {
-             current_function_decl = origin;
+             current_function_decl
+               = DECL_EXTERNAL (origin) ? NULL_TREE : origin;
              dwarf2out_decl (origin);
            }

@@ -26556,7 +26557,7 @@ dwarf2out_early_global_decl (tree decl)
          if ((old_die = lookup_decl_die (decl)) == NULL
              || is_declaration_die (old_die))
            {
-             current_function_decl = decl;
+             current_function_decl = DECL_EXTERNAL (decl) ? NULL_TREE : decl;
              dwarf2out_decl (decl);
            }

?


More information about the Gcc-bugs mailing list