re PR debug/86523 (ICE in gen_member_die, at dwarf2out.c:24933 starting from r262560)
authorRichard Biener <rguenther@suse.de>
Mon, 16 Jul 2018 13:57:32 +0000 (13:57 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 16 Jul 2018 13:57:32 +0000 (13:57 +0000)
2018-07-16  Richard Biener  <rguenther@suse.de>

PR lto/86523
* dwarf2out.c (dwarf2out_register_external_die): Assign DIE parents
for function-local FUNCTION_DECL and RESULT_DECL immediately.

* g++.dg/lto/pr86523-1_0.C: New testcase.
* g++.dg/lto/pr86523-2_0.C: Likewise.

From-SVN: r262696

gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lto/pr86523-1_0.C [new file with mode: 0644]
gcc/testsuite/g++.dg/lto/pr86523-2_0.C [new file with mode: 0644]

index 41ea59b7aef9bca6426223cf9693c437bfde8eb7..974168cef0b0df09351e992936ac2aded236e63c 100644 (file)
@@ -1,3 +1,9 @@
+2018-07-16  Richard Biener  <rguenther@suse.de>
+
+       PR lto/86523
+       * dwarf2out.c (dwarf2out_register_external_die): Assign DIE parents
+       for function-local FUNCTION_DECL and RESULT_DECL immediately.
+
 2018-07-16  Martin Liska  <mliska@suse.cz>
 
         PR ipa/86529
index ba5c63eaf0bbce369b93a40d15f632221b114afa..1e33cf07f094290320ba2ab31c19043c5858d4cf 100644 (file)
@@ -5959,7 +5959,9 @@ dwarf2out_register_external_die (tree decl, const char *sym,
           imports the original CUs.  */
        parent = comp_unit_die ();
       else if (TREE_CODE (ctx) == FUNCTION_DECL
+              && TREE_CODE (decl) != FUNCTION_DECL
               && TREE_CODE (decl) != PARM_DECL
+              && TREE_CODE (decl) != RESULT_DECL
               && TREE_CODE (decl) != BLOCK)
        /* Leave function local entities parent determination to when
           we process scope vars.  */
index a4053c9b12720d8d722d1eabf109cb9a11f5a421..57c599742592c594245f1043a3ff7a0bd48a7004 100644 (file)
@@ -1,3 +1,9 @@
+2018-07-16  Richard Biener  <rguenther@suse.de>
+
+       PR lto/86523
+       * g++.dg/lto/pr86523-1_0.C: New testcase.
+       * g++.dg/lto/pr86523-2_0.C: Likewise.
+
 2018-07-16  Martin Liska  <mliska@suse.cz>
 
         PR ipa/86529
diff --git a/gcc/testsuite/g++.dg/lto/pr86523-1_0.C b/gcc/testsuite/g++.dg/lto/pr86523-1_0.C
new file mode 100644 (file)
index 0000000..3f75cdd
--- /dev/null
@@ -0,0 +1,21 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-O2 -flto -g -shared}} }
+namespace {
+    class a typedef b;
+    class a {};
+} // namespace
+class c {
+    struct C {
+       b d;
+    };
+    C e() const;
+};
+c::C c::e() const {
+    C g;
+    struct h {
+       C g;
+       h(C *) {}
+    } f(&g);
+    return g;
+}
+
diff --git a/gcc/testsuite/g++.dg/lto/pr86523-2_0.C b/gcc/testsuite/g++.dg/lto/pr86523-2_0.C
new file mode 100644 (file)
index 0000000..f156230
--- /dev/null
@@ -0,0 +1,18 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-O2 -flto -g -shared}} }
+class a typedef b;
+class a {};
+class c {
+    struct C {
+       b d;
+    };
+    C e() const;
+};
+c::C c::e() const {
+    C g;
+    struct h {
+       C g;
+       h(C *) {}
+    } f(&g);
+    return g;
+}