public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] debug/PR78112: remove recent duplicates for DW_TAG_subprogram attributes
@ 2016-11-08 14:24 Pierre-Marie de Rodat
  2016-11-09  9:02 ` Richard Biener
  0 siblings, 1 reply; 5+ messages in thread
From: Pierre-Marie de Rodat @ 2016-11-08 14:24 UTC (permalink / raw)
  To: gcc-patches; +Cc: Pierre-Marie de Rodat

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] debug/PR78112: remove recent duplicates for DW_TAG_subprogram attributes
  2016-11-08 14:24 [PATCH] debug/PR78112: remove recent duplicates for DW_TAG_subprogram attributes Pierre-Marie de Rodat
@ 2016-11-09  9:02 ` Richard Biener
  2016-11-10 11:06   ` Pierre-Marie de Rodat
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Biener @ 2016-11-09  9:02 UTC (permalink / raw)
  To: Pierre-Marie de Rodat; +Cc: GCC Patches

On Tue, Nov 8, 2016 at 3:24 PM, Pierre-Marie de Rodat
<derodat@adacore.com> wrote:
> 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.

Using scan-assembler-times on the dwarf?

> Ok to commit?

Ok.

Richard.

> 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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] debug/PR78112: remove recent duplicates for DW_TAG_subprogram attributes
  2016-11-09  9:02 ` Richard Biener
@ 2016-11-10 11:06   ` Pierre-Marie de Rodat
  2016-11-18 14:03     ` Christophe Lyon
  0 siblings, 1 reply; 5+ messages in thread
From: Pierre-Marie de Rodat @ 2016-11-10 11:06 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

On 11/09/2016 10:02 AM, Richard Biener wrote:
> Using scan-assembler-times on the dwarf?

I always have a bad feeling about this kind of check as I imagine it can 
break very easily with legit changes. But I have nothing better to 
contribute, so I’ve added one such testcase. ;-)

>> Ok to commit?
>
> Ok.

This is committed as r242035. Thanks!

-- 
Pierre-Marie de Rodat

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] debug/PR78112: remove recent duplicates for DW_TAG_subprogram attributes
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Christophe Lyon @ 2016-11-18 14:03 UTC (permalink / raw)
  To: Pierre-Marie de Rodat; +Cc: Richard Biener, GCC Patches

On 10 November 2016 at 12:06, Pierre-Marie de Rodat <derodat@adacore.com> wrote:
> On 11/09/2016 10:02 AM, Richard Biener wrote:
>>
>> Using scan-assembler-times on the dwarf?
>
>
> I always have a bad feeling about this kind of check as I imagine it can
> break very easily with legit changes. But I have nothing better to
> contribute, so I’ve added one such testcase. ;-)
>
>>> Ok to commit?
>>
>>
>> Ok.
>
>
> This is committed as r242035. Thanks!
>
Hi,

Part of the new testcase added with this commit fails on arm* targets:
  g++.dg/pr78112.C   scan-assembler-times DW_AT_object_pointer 37

Christophe



> --
> Pierre-Marie de Rodat

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] debug/PR78112: remove recent duplicates for DW_TAG_subprogram attributes
  2016-11-18 14:03     ` Christophe Lyon
@ 2016-11-18 17:24       ` Pierre-Marie de Rodat
  0 siblings, 0 replies; 5+ messages in thread
From: Pierre-Marie de Rodat @ 2016-11-18 17:24 UTC (permalink / raw)
  To: Christophe Lyon; +Cc: Richard Biener, GCC Patches

Hi Christophe,

On 11/18/2016 03:03 PM, Christophe Lyon wrote:
> Hi,
>
> Part of the new testcase added with this commit fails on arm* targets:
>   g++.dg/pr78112.C   scan-assembler-times DW_AT_object_pointer 37

Thank you for the report.

As I said on the bugzilla 
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78112#c17), I reproduce 
inconsistent results on this even on a very reduced testcase. So I 
wonder if I should just remove this testcase.

-- 
Pierre-Marie de Rodat

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-11-18 17:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-08 14:24 [PATCH] debug/PR78112: remove recent duplicates for DW_TAG_subprogram attributes Pierre-Marie de Rodat
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

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).