re PR debug/51650 (LTO ICE in dwarf2out_finish, at dwarf2out.c:22501 while building...
authorRichard Guenther <rguenther@suse.de>
Tue, 3 Jan 2012 11:30:27 +0000 (11:30 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 3 Jan 2012 11:30:27 +0000 (11:30 +0000)
2012-01-03  Richard Guenther  <rguenther@suse.de>

PR debug/51650
* dwarf2out.c (dwarf2out_finish): Always create a DIE for
the context of a limbo DIE when it does not already exist.

* g++.dg/lto/pr51650-3_0.C: New testcase.

From-SVN: r182835

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

index cac010800fc365ba1a9ef25f4c5f143fb3a30c48..1c21031a0e5439dd6d165337547a0bde8637d6cd 100644 (file)
@@ -1,3 +1,9 @@
+2012-01-03  Richard Guenther  <rguenther@suse.de>
+
+       PR debug/51650
+       * dwarf2out.c (dwarf2out_finish): Always create a DIE for
+       the context of a limbo DIE when it does not already exist.
+
 2012-01-03  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/51719
index 850eb556217259bb6ff4b392bfbaf4b377504263..b5537752b132ca68b23e311910341807eff67154 100644 (file)
@@ -22501,15 +22501,8 @@ dwarf2out_finish (const char *filename)
              else if (TYPE_P (node->created_for))
                context = TYPE_CONTEXT (node->created_for);
 
-             gcc_assert (context
-                         && (TREE_CODE (context) == FUNCTION_DECL
-                             || TREE_CODE (context) == NAMESPACE_DECL));
-
-             origin = lookup_decl_die (context);
-             if (origin)
-               add_child_die (origin, die);
-             else
-               add_child_die (comp_unit_die (), die);
+             origin = get_context_die (context);
+             add_child_die (origin, die);
            }
        }
     }
index 6ac425a63d7b638816731f4fedcc6eebbd88dfd3..6185d583decdb0625c766ffbbae3e7ce8ed99bdc 100644 (file)
@@ -1,3 +1,8 @@
+2012-01-03  Richard Guenther  <rguenther@suse.de>
+
+       PR debug/51650
+       * g++.dg/lto/pr51650-3_0.C: New testcase.
+
 2012-01-03  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/15867
diff --git a/gcc/testsuite/g++.dg/lto/pr51650-3_0.C b/gcc/testsuite/g++.dg/lto/pr51650-3_0.C
new file mode 100644 (file)
index 0000000..e84d555
--- /dev/null
@@ -0,0 +1,20 @@
+// { dg-lto-do link }
+// { dg-lto-options { { -flto -g } } }
+
+struct T;
+struct C 
+{
+    typedef ::T T;
+    virtual void E();
+    static T *m ()
+      {
+       static T *d;
+       return d;
+      }
+};
+int
+fn ()
+{
+  C::m ();
+}
+int main() {}