public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH
       [not found] <54E6129C.5060706@redhat.com>
@ 2015-02-19 16:51 ` Aldy Hernandez
  2015-02-19 17:08   ` Jakub Jelinek
  0 siblings, 1 reply; 13+ messages in thread
From: Aldy Hernandez @ 2015-02-19 16:51 UTC (permalink / raw)
  To: jason merrill, Jakub Jelinek, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 994 bytes --]

[And this time, actually CCing the list :)].

Gentlemen!

Reading in the compiler state for pch (gt_pch_restore) obliterates the
DIE table, and consequently the DW_TAG_GNU_[BE]INCL* DIEs that may have
been in it.  This causes inconsistencies when reading in _any_
pre-compiled header into a source file that uses
-feliminate-dwarf2-dups, and consequently already has some
DW_TAG_GNU_[BE]INCL* DIEs.

Normally the DIE table should be empty this early on, especially since
mainline generates dwarf at the end of the compilation unit, but the DIE
table may have DW_TAG_GNU_[BE]INCL* DIEs that were created early by
dwarf2out_start_source_file/etc or it may have the DW_TAG_compile_unit.

I suppose we could merge incoming DIEs with existing DIEs and complicate
our lives, but considering we will probably have to tackle this in the
debug-early work, I propose we disable this combination for now (and
possibly permanently, unless we really care about it).

OK for mainline pending tests?

Aldy




[-- Attachment #2: curr --]
[-- Type: text/plain, Size: 1309 bytes --]

commit c0814b101417a5639fe70b41526b4e2d7a56ee52
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Thu Feb 19 07:35:59 2015 -0800

    	PR debug/46102
    	* c-pch.c (c_common_read_pch): Disable -feliminate-dwarf2-dups
    	if reading a pre-compiled header.

diff --git a/gcc/c-family/c-pch.c b/gcc/c-family/c-pch.c
index 0ede92a..6b442e2 100644
--- a/gcc/c-family/c-pch.c
+++ b/gcc/c-family/c-pch.c
@@ -381,6 +381,23 @@ c_common_read_pch (cpp_reader *pfile, const char *name,
   timevar_pop (TV_PCH_CPP_RESTORE);
 
   gt_pch_restore (f);
+
+  /* At pre-compiled header output time, we may have outputted a few
+     DIEs corresponding to DW_TAG_GNU_[BE]INCL.  Reading the compiler
+     state above will read in these DIEs, and obliterate any
+     DW_TAG_GNU_[BE]INCL so far generated.
+
+     Disable this combination for now.  When early debug generation is
+     implemented, we can probably get this combo to work.  */
+  if (flag_eliminate_dwarf2_dups)
+    {
+      warning_at (UNKNOWN_LOCATION, 0,
+		  "Pre-compiled headers cannot be used with -feliminate-dwarf2-dups.");
+      warning_at (UNKNOWN_LOCATION, 0,
+		  "-feliminate-dwarf2-dups has been disabled.");
+      flag_eliminate_dwarf2_dups = 0;
+    }
+
   cpp_set_line_map (pfile, line_table);
   rebuild_location_adhoc_htab (line_table);
 

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

* Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH
  2015-02-19 16:51 ` [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH Aldy Hernandez
@ 2015-02-19 17:08   ` Jakub Jelinek
  2015-02-19 18:41     ` Aldy Hernandez
  2015-02-25 16:06     ` Jason Merrill
  0 siblings, 2 replies; 13+ messages in thread
From: Jakub Jelinek @ 2015-02-19 17:08 UTC (permalink / raw)
  To: Aldy Hernandez; +Cc: jason merrill, gcc-patches

On Thu, Feb 19, 2015 at 08:45:08AM -0800, Aldy Hernandez wrote:
> [And this time, actually CCing the list :)].
> 
> Gentlemen!
> 
> Reading in the compiler state for pch (gt_pch_restore) obliterates the
> DIE table, and consequently the DW_TAG_GNU_[BE]INCL* DIEs that may have
> been in it.  This causes inconsistencies when reading in _any_
> pre-compiled header into a source file that uses
> -feliminate-dwarf2-dups, and consequently already has some
> DW_TAG_GNU_[BE]INCL* DIEs.
> 
> Normally the DIE table should be empty this early on, especially since
> mainline generates dwarf at the end of the compilation unit, but the DIE
> table may have DW_TAG_GNU_[BE]INCL* DIEs that were created early by
> dwarf2out_start_source_file/etc or it may have the DW_TAG_compile_unit.
> 
> I suppose we could merge incoming DIEs with existing DIEs and complicate
> our lives, but considering we will probably have to tackle this in the
> debug-early work, I propose we disable this combination for now (and
> possibly permanently, unless we really care about it).
> 
> OK for mainline pending tests?

Wouldn't it be better to disable PCH reading if -feliminate-dwarf2-dups
is used?  I mean, fail to read the PCH silently (or with warning for -Wpch
or what the warning is about why PCH couldn't be read or was ignored),
perhaps error out if you try to generate PCH with -feliminate-dwarf2-dups?

	Jakub

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

* Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH
  2015-02-19 17:08   ` Jakub Jelinek
@ 2015-02-19 18:41     ` Aldy Hernandez
  2015-02-19 19:07       ` Jakub Jelinek
  2015-02-25 16:06     ` Jason Merrill
  1 sibling, 1 reply; 13+ messages in thread
From: Aldy Hernandez @ 2015-02-19 18:41 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: jason merrill, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1947 bytes --]

On 02/19/2015 08:50 AM, Jakub Jelinek wrote:
> On Thu, Feb 19, 2015 at 08:45:08AM -0800, Aldy Hernandez wrote:
>> [And this time, actually CCing the list :)].
>>
>> Gentlemen!
>>
>> Reading in the compiler state for pch (gt_pch_restore) obliterates the
>> DIE table, and consequently the DW_TAG_GNU_[BE]INCL* DIEs that may have
>> been in it.  This causes inconsistencies when reading in _any_
>> pre-compiled header into a source file that uses
>> -feliminate-dwarf2-dups, and consequently already has some
>> DW_TAG_GNU_[BE]INCL* DIEs.
>>
>> Normally the DIE table should be empty this early on, especially since
>> mainline generates dwarf at the end of the compilation unit, but the DIE
>> table may have DW_TAG_GNU_[BE]INCL* DIEs that were created early by
>> dwarf2out_start_source_file/etc or it may have the DW_TAG_compile_unit.
>>
>> I suppose we could merge incoming DIEs with existing DIEs and complicate
>> our lives, but considering we will probably have to tackle this in the
>> debug-early work, I propose we disable this combination for now (and
>> possibly permanently, unless we really care about it).
>>
>> OK for mainline pending tests?
>
> Wouldn't it be better to disable PCH reading if -feliminate-dwarf2-dups
> is used?  I mean, fail to read the PCH silently (or with warning for -Wpch
> or what the warning is about why PCH couldn't be read or was ignored),

Sure, that sounds reasonable.  Patch attached.

> perhaps error out if you try to generate PCH with -feliminate-dwarf2-dups?

Well, any PCH file we generate will have some sort of early DIE in it 
(at the very least the compilation unit DIE) and we will read these in 
at PCH read-in time, obliterating whatever was already there.  But most 
importantly, with the attached patch we will not use these 
DW_TAG_GNU_[BE]INCL* DIEs, since the reader will avoid reading the pch 
file.  So, I don't think erroring out at output time is necessary.

How does this look?


[-- Attachment #2: curr --]
[-- Type: text/plain, Size: 1146 bytes --]

commit d90a408ad21aa0868cc13de24ea38e210ef78a68
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Thu Feb 19 07:35:59 2015 -0800

    	PR debug/46102
    	* c-pch.c (c_common_valid_pch): Mark PCH file with
    	-feliminate-dwarf2-dups as invalid.

diff --git a/gcc/c-family/c-pch.c b/gcc/c-family/c-pch.c
index 0ede92a..55163c9 100644
--- a/gcc/c-family/c-pch.c
+++ b/gcc/c-family/c-pch.c
@@ -224,6 +224,19 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
   const char *pch_ident;
   struct c_pch_validity v;
 
+  /* We may have outputted a few DIEs corresponding to
+     DW_TAG_GNU_[BE]INCL.  Reading the compiler state later will read
+     in these DIEs, and obliterate any DW_TAG_GNU_[BE]INCL the reader
+     may have generated itself.  Do not read the PCH if this may
+     happen.  */
+  if (flag_eliminate_dwarf2_dups)
+    {
+      if (cpp_get_options (pfile)->warn_invalid_pch)
+	cpp_error (pfile, CPP_DL_WARNING,
+		   "%s: cannot be used with -feliminate-dwarf2-dups", name);
+      return 2;
+    }
+
   /* Perform a quick test of whether this is a valid
      precompiled header for the current language.  */
 

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

* Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH
  2015-02-19 18:41     ` Aldy Hernandez
@ 2015-02-19 19:07       ` Jakub Jelinek
  2015-02-25 15:58         ` PING " Aldy Hernandez
  0 siblings, 1 reply; 13+ messages in thread
From: Jakub Jelinek @ 2015-02-19 19:07 UTC (permalink / raw)
  To: Aldy Hernandez, Jason Merrill; +Cc: gcc-patches

On Thu, Feb 19, 2015 at 10:33:20AM -0800, Aldy Hernandez wrote:
> Well, any PCH file we generate will have some sort of early DIE in it (at
> the very least the compilation unit DIE) and we will read these in at PCH
> read-in time, obliterating whatever was already there.  But most
> importantly, with the attached patch we will not use these
> DW_TAG_GNU_[BE]INCL* DIEs, since the reader will avoid reading the pch file.
> So, I don't think erroring out at output time is necessary.
> 
> How does this look?

Looks reasonable to me, but I'd prefer to defer this to Jason as debug
maintainer.

> commit d90a408ad21aa0868cc13de24ea38e210ef78a68
> Author: Aldy Hernandez <aldyh@redhat.com>
> Date:   Thu Feb 19 07:35:59 2015 -0800
> 
>     	PR debug/46102
>     	* c-pch.c (c_common_valid_pch): Mark PCH file with
>     	-feliminate-dwarf2-dups as invalid.
> 
> diff --git a/gcc/c-family/c-pch.c b/gcc/c-family/c-pch.c
> index 0ede92a..55163c9 100644
> --- a/gcc/c-family/c-pch.c
> +++ b/gcc/c-family/c-pch.c
> @@ -224,6 +224,19 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
>    const char *pch_ident;
>    struct c_pch_validity v;
>  
> +  /* We may have outputted a few DIEs corresponding to
> +     DW_TAG_GNU_[BE]INCL.  Reading the compiler state later will read
> +     in these DIEs, and obliterate any DW_TAG_GNU_[BE]INCL the reader
> +     may have generated itself.  Do not read the PCH if this may
> +     happen.  */
> +  if (flag_eliminate_dwarf2_dups)
> +    {
> +      if (cpp_get_options (pfile)->warn_invalid_pch)
> +	cpp_error (pfile, CPP_DL_WARNING,
> +		   "%s: cannot be used with -feliminate-dwarf2-dups", name);
> +      return 2;
> +    }
> +
>    /* Perform a quick test of whether this is a valid
>       precompiled header for the current language.  */
>  


	Jakub

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

* PING Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH
  2015-02-19 19:07       ` Jakub Jelinek
@ 2015-02-25 15:58         ` Aldy Hernandez
  0 siblings, 0 replies; 13+ messages in thread
From: Aldy Hernandez @ 2015-02-25 15:58 UTC (permalink / raw)
  To: jason merrill; +Cc: Jakub Jelinek, gcc-patches

On 02/19/2015 10:41 AM, Jakub Jelinek wrote:
> On Thu, Feb 19, 2015 at 10:33:20AM -0800, Aldy Hernandez wrote:
>> Well, any PCH file we generate will have some sort of early DIE in it (at
>> the very least the compilation unit DIE) and we will read these in at PCH
>> read-in time, obliterating whatever was already there.  But most
>> importantly, with the attached patch we will not use these
>> DW_TAG_GNU_[BE]INCL* DIEs, since the reader will avoid reading the pch file.
>> So, I don't think erroring out at output time is necessary.
>>
>> How does this look?
>
> Looks reasonable to me, but I'd prefer to defer this to Jason as debug
> maintainer.
>
>> commit d90a408ad21aa0868cc13de24ea38e210ef78a68
>> Author: Aldy Hernandez <aldyh@redhat.com>
>> Date:   Thu Feb 19 07:35:59 2015 -0800
>>
>>      	PR debug/46102
>>      	* c-pch.c (c_common_valid_pch): Mark PCH file with
>>      	-feliminate-dwarf2-dups as invalid.
>>
>> diff --git a/gcc/c-family/c-pch.c b/gcc/c-family/c-pch.c
>> index 0ede92a..55163c9 100644
>> --- a/gcc/c-family/c-pch.c
>> +++ b/gcc/c-family/c-pch.c
>> @@ -224,6 +224,19 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
>>     const char *pch_ident;
>>     struct c_pch_validity v;
>>
>> +  /* We may have outputted a few DIEs corresponding to
>> +     DW_TAG_GNU_[BE]INCL.  Reading the compiler state later will read
>> +     in these DIEs, and obliterate any DW_TAG_GNU_[BE]INCL the reader
>> +     may have generated itself.  Do not read the PCH if this may
>> +     happen.  */
>> +  if (flag_eliminate_dwarf2_dups)
>> +    {
>> +      if (cpp_get_options (pfile)->warn_invalid_pch)
>> +	cpp_error (pfile, CPP_DL_WARNING,
>> +		   "%s: cannot be used with -feliminate-dwarf2-dups", name);
>> +      return 2;
>> +    }
>> +
>>     /* Perform a quick test of whether this is a valid
>>        precompiled header for the current language.  */
>>
>
>
> 	Jakub
>

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

* Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH
  2015-02-19 17:08   ` Jakub Jelinek
  2015-02-19 18:41     ` Aldy Hernandez
@ 2015-02-25 16:06     ` Jason Merrill
  2015-02-25 17:28       ` Aldy Hernandez
  1 sibling, 1 reply; 13+ messages in thread
From: Jason Merrill @ 2015-02-25 16:06 UTC (permalink / raw)
  To: Jakub Jelinek, Aldy Hernandez; +Cc: gcc-patches

On 02/19/2015 11:50 AM, Jakub Jelinek wrote:
> Wouldn't it be better to disable PCH reading if -feliminate-dwarf2-dups
> is used?

In the abstract, perhaps, but given

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

I'd prefer to disable the useless thing.  :)

We might actually disable -feliminate-dwarf2-dups entirely until that 
bug is fixed.

Jason

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

* Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH
  2015-02-25 16:06     ` Jason Merrill
@ 2015-02-25 17:28       ` Aldy Hernandez
  2015-02-25 21:20         ` Jason Merrill
  0 siblings, 1 reply; 13+ messages in thread
From: Aldy Hernandez @ 2015-02-25 17:28 UTC (permalink / raw)
  To: Jason Merrill, Jakub Jelinek; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1048 bytes --]

On 02/25/2015 07:59 AM, Jason Merrill wrote:
> On 02/19/2015 11:50 AM, Jakub Jelinek wrote:
>> Wouldn't it be better to disable PCH reading if -feliminate-dwarf2-dups
>> is used?
>
> In the abstract, perhaps, but given
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53118
>
> I'd prefer to disable the useless thing.  :)

Patch attached.

>
> We might actually disable -feliminate-dwarf2-dups entirely until that
> bug is fixed.

Well technically, this bug is a subset of 53118.  I would like to mark 
it as a duplicate, and can tackle it as part of my early debug work. 
After all, we're going to get a lot more DIEs that will get streamed 
early on, which PCH will have to deal with.  So, this will all get fixed.

Also, can we downgrade 53118, perhaps to a P4?  As Ian mentions here:

https://gcc.gnu.org/ml/gcc-help/2010-09/msg00083.html

There are better ways of optimizing this at link time for dwarf4, and 
the fact that this has been broken since GCC 4.0 would hint that this 
may not be of P2 importance?

OK for mainline pending tests?

[-- Attachment #2: curr --]
[-- Type: text/plain, Size: 3490 bytes --]

commit 512b997ad55f45898fce2704c0289d472d08cab1
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Wed Feb 25 08:49:59 2015 -0800

    	PR debug/46102
    	* dwarf2out.c (dwarf2out_init): Disable -feliminate-dwarf2-dups.

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index ebf41c8..3f2837b 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -22621,6 +22621,13 @@ output_macinfo (void)
 static void
 dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
 {
+  /* This option is currently broken, see (PR53118 and PR46102).  */
+  if (flag_eliminate_dwarf2_dups)
+    {
+      warning (0, "ignoring unimplemented option -feliminate-dwarf2-dups");
+      flag_eliminate_dwarf2_dups = 0;
+    }
+
   /* Allocate the file_table.  */
   file_table = hash_table<dwarf_file_hasher>::create_ggc (50);
 
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2-1.C b/gcc/testsuite/g++.dg/debug/dwarf2-1.C
index e90d510..913bfe5 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2-1.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2-1.C
@@ -20,3 +20,5 @@ namespace N
 }
 
 N::Derived thing;
+
+/* { dg-bogus "ignoring unimplemented option -feliminate-dwarf2-dups" "unimplemented" { xfail *-*-* } 1 } */
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2-2.C b/gcc/testsuite/g++.dg/debug/dwarf2-2.C
index 9e6dbd2..214bbb1 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2-2.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2-2.C
@@ -15,3 +15,5 @@ void A::foo ()
 {
   using namespace N;
 }
+
+/* { dg-bogus "ignoring unimplemented option -feliminate-dwarf2-dups" "unimplemented" { xfail *-*-* } 1 } */
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/typedef5.C b/gcc/testsuite/g++.dg/debug/dwarf2/typedef5.C
index d9d058c..17ffafa 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/typedef5.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/typedef5.C
@@ -8,3 +8,5 @@ typedef struct
 } A;
 
 A a;
+
+/* { dg-bogus "ignoring unimplemented option -feliminate-dwarf2-dups" "unimplemented" { xfail *-*-* } 1 } */
diff --git a/gcc/testsuite/g++.dg/debug/pr46123.C b/gcc/testsuite/g++.dg/debug/pr46123.C
index 9e115cd..f5e5f9f 100644
--- a/gcc/testsuite/g++.dg/debug/pr46123.C
+++ b/gcc/testsuite/g++.dg/debug/pr46123.C
@@ -45,3 +45,5 @@ int main ()
     return 1;
   return 0;
 }
+
+/* { dg-bogus "ignoring unimplemented option -feliminate-dwarf2-dups" "unimplemented" { xfail *-*-* } 1 } */
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2-3.c b/gcc/testsuite/gcc.dg/debug/dwarf2-3.c
index f0c129c..e649dfa 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2-3.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2-3.c
@@ -11,3 +11,5 @@ int main()
   p.x = 0;
   p.y = 0;
 }
+
+/* { dg-bogus "ignoring unimplemented option -feliminate-dwarf2-dups" "unimplemented" { xfail *-*-* } 1 } */
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dups-types.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dups-types.c
index d9c01d0..4d3a9e8 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/dups-types.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dups-types.c
@@ -1,8 +1,10 @@
 /* Test that these two options can work together.  */
 /* { dg-options "-gdwarf-4 -dA -feliminate-dwarf2-dups -fdebug-types-section" } */
-/* { dg-final { scan-assembler "DW.dups_types\.h\[^)\]*. DW_TAG_typedef" } } */
+/* { dg-final { scan-assembler "DW.dups_types\.h\[^)\]*. DW_TAG_typedef" { xfail *-*-* } } } */
 /* { dg-final { scan-assembler "DW_TAG_type_unit" } } */
 
 #include "dups-types.h"
 
 A2 a;
+
+/* { dg-bogus "ignoring unimplemented option -feliminate-dwarf2-dups" "unimplemented" { xfail *-*-* } 1 } */

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

* Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH
  2015-02-25 17:28       ` Aldy Hernandez
@ 2015-02-25 21:20         ` Jason Merrill
  2015-02-25 21:35           ` Mike Stump
  2015-02-26  2:48           ` Aldy Hernandez
  0 siblings, 2 replies; 13+ messages in thread
From: Jason Merrill @ 2015-02-25 21:20 UTC (permalink / raw)
  To: Aldy Hernandez, Jakub Jelinek; +Cc: gcc-patches

On 02/25/2015 12:02 PM, Aldy Hernandez wrote:
> +  if (flag_eliminate_dwarf2_dups)
> +    {
> +      warning (0, "ignoring unimplemented option -feliminate-dwarf2-dups");
> +      flag_eliminate_dwarf2_dups = 0;
> +    }

I think we only want to disable it for C++, not all languages.

Jason

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

* Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH
  2015-02-25 21:20         ` Jason Merrill
@ 2015-02-25 21:35           ` Mike Stump
  2015-02-26  2:48           ` Aldy Hernandez
  1 sibling, 0 replies; 13+ messages in thread
From: Mike Stump @ 2015-02-25 21:35 UTC (permalink / raw)
  To: Aldy Hernandez; +Cc: Jakub Jelinek, gcc-patches, Jason Merrill

On Feb 25, 2015, at 1:13 PM, Jason Merrill <jason@redhat.com> wrote:
> On 02/25/2015 12:02 PM, Aldy Hernandez wrote:
>> +  if (flag_eliminate_dwarf2_dups)
>> +    {
>> +      warning (0, "ignoring unimplemented option -feliminate-dwarf2-dups");
>> +      flag_eliminate_dwarf2_dups = 0;
>> +    }
> 
> I think we only want to disable it for C++, not all languages.

And Objective-C++…  if you strcmp the name in a dwarf file).  Prefer flag_eliminate_dwarf2_dups = 0 in the C++ startup code someplace.

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

* Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH
  2015-02-25 21:20         ` Jason Merrill
  2015-02-25 21:35           ` Mike Stump
@ 2015-02-26  2:48           ` Aldy Hernandez
  2015-02-26  2:57             ` Jason Merrill
  1 sibling, 1 reply; 13+ messages in thread
From: Aldy Hernandez @ 2015-02-26  2:48 UTC (permalink / raw)
  To: Jason Merrill, Jakub Jelinek; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 584 bytes --]

On 02/25/2015 01:13 PM, Jason Merrill wrote:
> On 02/25/2015 12:02 PM, Aldy Hernandez wrote:
>> +  if (flag_eliminate_dwarf2_dups)
>> +    {
>> +      warning (0, "ignoring unimplemented option
>> -feliminate-dwarf2-dups");
>> +      flag_eliminate_dwarf2_dups = 0;
>> +    }
>
> I think we only want to disable it for C++, not all languages.

Attached.

I also moved the -felimite-dwarf2-dups tests that were in 
g{cc,++}.dg/debug/ into g{cc,++}.dg/debug/dwarf2/ where they belong.  It 
makes no sense to test -feliminate-dwarf2-dups with stabs.

Ok pending another round of tests?


[-- Attachment #2: curr --]
[-- Type: text/plain, Size: 7406 bytes --]

commit cdd5c3448ed3ecef9a40c8596731a082c8e1be0d
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Wed Feb 25 08:49:59 2015 -0800

    	PR debug/46102
    	* dwarf2out.c (dwarf2out_init): Disable -feliminate-dwarf2-dups.
    testsuite/
    	PR debug/46102
    	* g++.dg/debug/dwarf2-1.C: XFAIL and move...
    	* g++.dg/debug/dwarf2/dwarf2-1.C: ...here.
    	* g++.dg/debug/dwarf2-2.C: XFAIL and move...
    	* g++.dg/debug/dwarf2/dwarf2-2.C: ...here.
    	* g++.dg/debug/dwarf2/typedef5.C: XFAIL.
    	* g++.dg/debug/pr46123.C: XFAIL and move...
    	* g++.dg/debug/dwarf2/pr46123-2.C: ...here.
    	* gcc.dg/debug/dwarf2-3.c: Move...
    	* gcc.dg/debug/dwarf2/dwarf2-3.c: ...here.

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index ebf41c8..270c4fd 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -22621,6 +22621,14 @@ output_macinfo (void)
 static void
 dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
 {
+  /* This option is currently broken, see (PR53118 and PR46102).  */
+  if (flag_eliminate_dwarf2_dups
+      && strstr (lang_hooks.name, "C++"))
+    {
+      warning (0, "ignoring unimplemented option -feliminate-dwarf2-dups");
+      flag_eliminate_dwarf2_dups = 0;
+    }
+
   /* Allocate the file_table.  */
   file_table = hash_table<dwarf_file_hasher>::create_ggc (50);
 
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2-1.C b/gcc/testsuite/g++.dg/debug/dwarf2-1.C
deleted file mode 100644
index e90d510..0000000
--- a/gcc/testsuite/g++.dg/debug/dwarf2-1.C
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (C) 2006 Free Software Foundation, Inc.
-// Contributed by Nathan Sidwell 6 Jan 2006 <nathan@codesourcery.com>
-
-// PR 24824
-// Origin:   	 wanderer@rsu.ru
-
-// { dg-options "-feliminate-dwarf2-dups" }
-
-namespace N
-{
-  struct Base
-  {
-    int m;
-  };
-
-  struct Derived : Base
-  {
-    using Base::m;
-  };
-}
-
-N::Derived thing;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2-2.C b/gcc/testsuite/g++.dg/debug/dwarf2-2.C
deleted file mode 100644
index 9e6dbd2..0000000
--- a/gcc/testsuite/g++.dg/debug/dwarf2-2.C
+++ /dev/null
@@ -1,17 +0,0 @@
-// PR debug/27057
-// { dg-do compile }
-// { dg-options "-g -feliminate-dwarf2-dups" }
-
-namespace N
-{
-}
-
-struct A
-{
-  void foo ();
-};
-
-void A::foo ()
-{
-  using namespace N;
-}
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/dwarf2-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/dwarf2-1.C
new file mode 100644
index 0000000..fdef5da
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/dwarf2-1.C
@@ -0,0 +1,24 @@
+// Copyright (C) 2006 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 6 Jan 2006 <nathan@codesourcery.com>
+
+// PR 24824
+// Origin:   	 wanderer@rsu.ru
+
+// { dg-options "-gdwarf -feliminate-dwarf2-dups" }
+
+namespace N
+{
+  struct Base
+  {
+    int m;
+  };
+
+  struct Derived : Base
+  {
+    using Base::m;
+  };
+}
+
+N::Derived thing;
+
+/* { dg-bogus "ignoring unimplemented option -feliminate-dwarf2-dups" "unimplemented" { xfail *-*-* } 1 } */
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/dwarf2-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/dwarf2-2.C
new file mode 100644
index 0000000..643e678
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/dwarf2-2.C
@@ -0,0 +1,19 @@
+// PR debug/27057
+// { dg-do compile }
+// { dg-options "-gdwarf -feliminate-dwarf2-dups" }
+
+namespace N
+{
+}
+
+struct A
+{
+  void foo ();
+};
+
+void A::foo ()
+{
+  using namespace N;
+}
+
+/* { dg-bogus "ignoring unimplemented option -feliminate-dwarf2-dups" "unimplemented" { xfail *-*-* } 1 } */
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr46123-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr46123-2.C
new file mode 100644
index 0000000..f5e5f9f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr46123-2.C
@@ -0,0 +1,49 @@
+// PR debug/46123
+// { dg-do compile }
+// { dg-options "-g -feliminate-dwarf2-dups" }
+
+struct foo
+{
+  static int bar ()
+  {
+    int i;
+    static int baz = 1;
+    {
+      static int baz = 2;
+      i = baz++;
+    }
+    {
+      struct baz
+      {
+	static int m ()
+	{
+	  static int n;
+	  return n += 10;
+	}
+      };
+      baz a;
+      i += a.m ();
+    }
+    {
+      static int baz = 3;
+      i += baz;
+      baz += 30;
+    }
+    i += baz;
+    baz += 60;
+    return i;
+  }
+};
+
+int main ()
+{
+  foo x;
+
+  if (x.bar () != 16)
+    return 1;
+  if (x.bar() != 117)
+    return 1;
+  return 0;
+}
+
+/* { dg-bogus "ignoring unimplemented option -feliminate-dwarf2-dups" "unimplemented" { xfail *-*-* } 1 } */
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/typedef5.C b/gcc/testsuite/g++.dg/debug/dwarf2/typedef5.C
index d9d058c..17ffafa 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/typedef5.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/typedef5.C
@@ -8,3 +8,5 @@ typedef struct
 } A;
 
 A a;
+
+/* { dg-bogus "ignoring unimplemented option -feliminate-dwarf2-dups" "unimplemented" { xfail *-*-* } 1 } */
diff --git a/gcc/testsuite/g++.dg/debug/pr46123.C b/gcc/testsuite/g++.dg/debug/pr46123.C
deleted file mode 100644
index 9e115cd..0000000
--- a/gcc/testsuite/g++.dg/debug/pr46123.C
+++ /dev/null
@@ -1,47 +0,0 @@
-// PR debug/46123
-// { dg-do compile }
-// { dg-options "-g -feliminate-dwarf2-dups" }
-
-struct foo
-{
-  static int bar ()
-  {
-    int i;
-    static int baz = 1;
-    {
-      static int baz = 2;
-      i = baz++;
-    }
-    {
-      struct baz
-      {
-	static int m ()
-	{
-	  static int n;
-	  return n += 10;
-	}
-      };
-      baz a;
-      i += a.m ();
-    }
-    {
-      static int baz = 3;
-      i += baz;
-      baz += 30;
-    }
-    i += baz;
-    baz += 60;
-    return i;
-  }
-};
-
-int main ()
-{
-  foo x;
-
-  if (x.bar () != 16)
-    return 1;
-  if (x.bar() != 117)
-    return 1;
-  return 0;
-}
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2-3.c b/gcc/testsuite/gcc.dg/debug/dwarf2-3.c
deleted file mode 100644
index f0c129c..0000000
--- a/gcc/testsuite/gcc.dg/debug/dwarf2-3.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Test -feliminate-dwarf2-dups */
-/* Contributed by Devang Patel <dpatel@apple.com> */
-/* { dg-do compile } */
-/* { dg-options "-feliminate-dwarf2-dups" } */
-
-#include "dwarf2-3.h"
-
-int main()
-{
-  struct point p;
-  p.x = 0;
-  p.y = 0;
-}
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2-3.h b/gcc/testsuite/gcc.dg/debug/dwarf2-3.h
deleted file mode 100644
index 26ad0ba..0000000
--- a/gcc/testsuite/gcc.dg/debug/dwarf2-3.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Test -feliminate-dwarf2-dups */
-/* Contributed by Devang Patel <dpatel@apple.com> */
-
-struct point
-{
-  int x;
-  int y;
-};
-
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-3.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-3.c
new file mode 100644
index 0000000..e364670
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-3.c
@@ -0,0 +1,13 @@
+/* Test -feliminate-dwarf2-dups */
+/* Contributed by Devang Patel <dpatel@apple.com> */
+/* { dg-do compile } */
+/* { dg-options "-gdwarf -feliminate-dwarf2-dups" } */
+
+#include "dwarf2-3.h"
+
+int main()
+{
+  struct point p;
+  p.x = 0;
+  p.y = 0;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-3.h b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-3.h
new file mode 100644
index 0000000..26ad0ba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-3.h
@@ -0,0 +1,9 @@
+/* Test -feliminate-dwarf2-dups */
+/* Contributed by Devang Patel <dpatel@apple.com> */
+
+struct point
+{
+  int x;
+  int y;
+};
+

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

* Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH
  2015-02-26  2:48           ` Aldy Hernandez
@ 2015-02-26  2:57             ` Jason Merrill
  2015-02-26  3:08               ` Aldy Hernandez
  0 siblings, 1 reply; 13+ messages in thread
From: Jason Merrill @ 2015-02-26  2:57 UTC (permalink / raw)
  To: Aldy Hernandez, Jakub Jelinek; +Cc: gcc-patches

On 02/25/2015 09:16 PM, Aldy Hernandez wrote:
> +      warning (0, "ignoring unimplemented option -feliminate-dwarf2-dups");

Similarly, I'd rather say it's broken for C++.  OK with that change.

Jason

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

* Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH
  2015-02-26  2:57             ` Jason Merrill
@ 2015-02-26  3:08               ` Aldy Hernandez
  2015-02-26 13:57                 ` Jason Merrill
  0 siblings, 1 reply; 13+ messages in thread
From: Aldy Hernandez @ 2015-02-26  3:08 UTC (permalink / raw)
  To: Jason Merrill, Jakub Jelinek; +Cc: gcc-patches

On 02/25/2015 06:47 PM, Jason Merrill wrote:
> On 02/25/2015 09:16 PM, Aldy Hernandez wrote:
>> +      warning (0, "ignoring unimplemented option
>> -feliminate-dwarf2-dups");
>
> Similarly, I'd rather say it's broken for C++.  OK with that change.

Interesting.  As in "ignoring broken C++ option -feliminate-dwarf2-dups" 
or as in "ignoring unimplemented C++ option -feleminate-dwarf2-dups".

??

Just making sure.

Aldy

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

* Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH
  2015-02-26  3:08               ` Aldy Hernandez
@ 2015-02-26 13:57                 ` Jason Merrill
  0 siblings, 0 replies; 13+ messages in thread
From: Jason Merrill @ 2015-02-26 13:57 UTC (permalink / raw)
  To: Aldy Hernandez, Jakub Jelinek; +Cc: gcc-patches

On 02/25/2015 09:53 PM, Aldy Hernandez wrote:
> On 02/25/2015 06:47 PM, Jason Merrill wrote:
>> On 02/25/2015 09:16 PM, Aldy Hernandez wrote:
>>> +      warning (0, "ignoring unimplemented option
>>> -feliminate-dwarf2-dups");
>>
>> Similarly, I'd rather say it's broken for C++.  OK with that change.
>
> Interesting.  As in "ignoring broken C++ option -feliminate-dwarf2-dups"
> or as in "ignoring unimplemented C++ option -feleminate-dwarf2-dups".

As in "-feliminate-dwarf2-dups is broken for C++, ignoring"

Jason

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

end of thread, other threads:[~2015-02-26 13:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <54E6129C.5060706@redhat.com>
2015-02-19 16:51 ` [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH Aldy Hernandez
2015-02-19 17:08   ` Jakub Jelinek
2015-02-19 18:41     ` Aldy Hernandez
2015-02-19 19:07       ` Jakub Jelinek
2015-02-25 15:58         ` PING " Aldy Hernandez
2015-02-25 16:06     ` Jason Merrill
2015-02-25 17:28       ` Aldy Hernandez
2015-02-25 21:20         ` Jason Merrill
2015-02-25 21:35           ` Mike Stump
2015-02-26  2:48           ` Aldy Hernandez
2015-02-26  2:57             ` Jason Merrill
2015-02-26  3:08               ` Aldy Hernandez
2015-02-26 13:57                 ` Jason Merrill

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