This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR83765
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 10 Jan 2018 11:50:00 +0100 (CET)
- Subject: [PATCH] Fix PR83765
- Authentication-results: sourceware.org; auth=none
The following fixes LTO bootstrap with Ada enabled which currently
fails in the attribute duplicate sanity checking I added last year.
The reason is we end up with a BLOCK_NONLOCALIZED_VARS function decl
inlined somewhere (thus has received a self-origin from dwarf2out)
and referenced in a function inlined twice. Then gen_subprgram_die
ends up adding DW_AT_declaration multiple times.
The fix is to elide the old_die && declaration handling (do nothing)
to also cover the origin != NULL case.
LTO bootstrap and regular bootstrap / testing in progress on
x86_64-unknown-linux-gnu.
I'm going to commit this if no problems show up.
Richard.
2018-01-10 Richard Biener <rguenther@suse.de>
PR debug/83765
* dwarf2out.c (gen_subprogram_die): Hoist old_die && declaration
early out so it also covers the case where we have a non-NULL
origin.
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c (revision 256378)
+++ gcc/dwarf2out.c (working copy)
@@ -22044,6 +22044,11 @@ gen_subprogram_die (tree decl, dw_die_re
int declaration = (current_function_decl != decl
|| class_or_namespace_scope_p (context_die));
+ /* A declaration that has been previously dumped needs no
+ additional information. */
+ if (old_die && declaration)
+ return;
+
/* Now that the C++ front end lazily declares artificial member fns, we
might need to retrofit the declaration into its class. */
if (!declaration && !origin && !old_die
@@ -22084,11 +22089,6 @@ gen_subprogram_die (tree decl, dw_die_re
much as possible. */
else if (old_die)
{
- /* A declaration that has been previously dumped needs no
- additional information. */
- if (declaration)
- return;
-
if (!get_AT_flag (old_die, DW_AT_declaration)
/* We can have a normal definition following an inline one in the
case of redefinition of GNU C extern inlines.