public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <derodat@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Pierre-Marie de Rodat <derodat@adacore.com>
Subject: [PATCH] debug/PR78112: remove recent duplicates for DW_TAG_subprogram attributes
Date: Tue, 08 Nov 2016 14:24:00 -0000	[thread overview]
Message-ID: <20161108142405.20341-1-derodat@adacore.com> (raw)

Hello,

This patch comes from the discussion for PR debug/78112
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78112).  It seems to fix
the regression Rainer detected on x86_64-apple-darwin, although I still
wonder why remaining duplicate attributes (which were already present
before my original patch) are not a problem on this platform.

Anyway, bootstrapped and regtested on x86_64-linux.  As I said on the
PR, I managed to check with a Python script that there were no
duplicates anymore but I don't know how to turn this into a DejaGNU
testcase.

Ok to commit?

gcc/

	PR debug/78112
	* dwarf2out.c (dwarf2out_early_global_decl): Call dwarf2out_decl
	on the context only when it has no DIE yet.
---
 gcc/dwarf2out.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 1dfff38..f9ec090 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -25256,11 +25256,11 @@ dwarf2out_early_global_decl (tree decl)
 	  if (!DECL_STRUCT_FUNCTION (decl))
 	    goto early_decl_exit;
 
-	  /* For nested functions, emit DIEs for the parents first so that all
-	     nested DIEs are generated at the proper scope in the first
-	     shot.  */
+	  /* For nested functions, make sure we have DIEs for the parents first
+	     so that all nested DIEs are generated at the proper scope in the
+	     first shot.  */
 	  tree context = decl_function_context (decl);
-	  if (context != NULL)
+	  if (context != NULL && lookup_decl_die (context) == NULL)
 	    {
 	      current_function_decl = context;
 	      dwarf2out_decl (context);
-- 
2.10.2

             reply	other threads:[~2016-11-08 14:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-08 14:24 Pierre-Marie de Rodat [this message]
2016-11-09  9:02 ` Richard Biener
2016-11-10 11:06   ` Pierre-Marie de Rodat
2016-11-18 14:03     ` Christophe Lyon
2016-11-18 17:24       ` Pierre-Marie de Rodat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161108142405.20341-1-derodat@adacore.com \
    --to=derodat@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).