re PR debug/87295 ([early debug] ICE with -ffat-lto-objects -fdebug-types-section -g)
authorRichard Biener <rguenther@suse.de>
Sun, 3 Feb 2019 10:53:01 +0000 (10:53 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sun, 3 Feb 2019 10:53:01 +0000 (10:53 +0000)
2019-02-03  Richard Biener  <rguenther@suse.de>

PR debug/87295
* dwarf2out.c (copy_ancestor_tree): Register non-stubs as
orig.

* g++.dg/debug/dwarf2/pr87295.C: New testcase.

From-SVN: r268485

gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/dwarf2/pr87295.C [new file with mode: 0644]

index 33d4ecf5108594f7fc8d8b9c2e4196a49f99f27b..dc2116ba92a5b3f348467680766be6bb92409889 100644 (file)
@@ -1,3 +1,9 @@
+2019-02-03  Richard Biener  <rguenther@suse.de>
+
+       PR debug/87295
+       * dwarf2out.c (copy_ancestor_tree): Register non-stubs as
+       orig.
+
 2019-02-02  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/87887
index c2a590148b4e7e90d8242e3c54cf34571804ff3c..d78e75c914afc9bb1e4999606a331111ec9a18ab 100644 (file)
@@ -8169,6 +8169,11 @@ copy_ancestor_tree (dw_die_ref unit, dw_die_ref die,
   decl_table_entry **slot = NULL;
   struct decl_table_entry *entry = NULL;
 
+  /* If DIE refers to a stub unfold that so we get the appropriate
+     DIE registered as orig in decl_table.  */
+  if (dw_die_ref c = get_AT_ref (die, DW_AT_signature))
+    die = c;
+
   if (decl_table)
     {
       /* Check if the entry has already been copied to UNIT.  */
index 904a5911d7732b0aa3a689904c96e0c00d5585e9..30ac08b77abbeba28ed99f91a0429a92bf259a55 100644 (file)
@@ -1,3 +1,8 @@
+2019-02-03  Richard Biener  <rguenther@suse.de>
+
+       PR debug/87295
+       * g++.dg/debug/dwarf2/pr87295.C: New testcase.
+
 2019-02-02  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/88298
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr87295.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr87295.C
new file mode 100644 (file)
index 0000000..3afe762
--- /dev/null
@@ -0,0 +1,22 @@
+// { dg-additional-options "-fdebug-types-section" }
+// { dg-require-effective-target c++11 }
+
+struct A {};
+namespace N {
+    struct B {
+       using C = struct H {};
+       using D = A;
+    };
+}
+struct E : N::B {
+    typedef C C;
+};
+namespace N {
+    struct F {
+       E::C d;
+       E::D h;
+    };
+}
+struct G {
+    N::F i;
+} j;