Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH

2015-02-26 Thread Jason Merrill

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



PING Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH

2015-02-25 Thread Aldy Hernandez

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 al...@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





Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH

2015-02-25 Thread Jason Merrill

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



Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH

2015-02-25 Thread Aldy Hernandez

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?
commit 512b997ad55f45898fce2704c0289d472d08cab1
Author: Aldy Hernandez al...@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_tabledwarf_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 } */


Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH

2015-02-25 Thread Jason Merrill

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



Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH

2015-02-25 Thread Mike Stump
On Feb 25, 2015, at 1:13 PM, Jason Merrill ja...@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.

Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH

2015-02-25 Thread Jason Merrill

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



Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH

2015-02-25 Thread Aldy Hernandez

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



Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH

2015-02-25 Thread Aldy Hernandez

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?

commit cdd5c3448ed3ecef9a40c8596731a082c8e1be0d
Author: Aldy Hernandez al...@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_tabledwarf_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..000
--- 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 nat...@codesourcery.com
-
-// PR 24824
-// Origin:  wande...@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..000
--- 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 000..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 nat...@codesourcery.com
+
+// PR 24824
+// Origin:  wande...@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 000..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 000..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;
+}

Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH

2015-02-19 Thread Jakub Jelinek
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 al...@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


Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH

2015-02-19 Thread Aldy Hernandez

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?

commit d90a408ad21aa0868cc13de24ea38e210ef78a68
Author: Aldy Hernandez al...@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.  */
 


Re: [patch] PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH

2015-02-19 Thread Jakub Jelinek
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