PR debug/46102 Disable -feliminate-dwarf2-dups when reading a PCH
diff mbox

Message ID 54EE81E5.4080801@redhat.com
State New
Headers show

Commit Message

Aldy Hernandez Feb. 26, 2015, 2:16 a.m. UTC
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 <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.

Comments

Jason Merrill Feb. 26, 2015, 2:47 a.m. UTC | #1
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
Aldy Hernandez Feb. 26, 2015, 2:53 a.m. UTC | #2
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
Jason Merrill Feb. 26, 2015, 1:43 p.m. UTC | #3
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

Patch
diff mbox

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;
+};
+