re PR c++/48073 (ICE with -flto in templated C++ code)
authorRichard Guenther <rguenther@suse.de>
Fri, 11 Mar 2011 15:59:42 +0000 (15:59 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 11 Mar 2011 15:59:42 +0000 (15:59 +0000)
2011-03-11  Richard Guenther  <rguenther@suse.de>

PR lto/48073
* tree.c (find_decls_types_r): Do not walk types only reachable
from IDENTIFIER_NODEs.

* g++.dg/lto/20110311-1_0.C: New testcase.

From-SVN: r170875

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

index 1da3589cc3fb59e701b671385099b490b3d44319..dea9da94d076881f61fd7c9ad2fcf1f8853659e7 100644 (file)
@@ -1,3 +1,9 @@
+2011-03-11  Richard Guenther  <rguenther@suse.de>
+
+       PR lto/48073
+       * tree.c (find_decls_types_r): Do not walk types only reachable
+       from IDENTIFIER_NODEs.
+
 2011-03-11  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/48044
index 7e7b9243da599425b9f824b01a9173a8705ff10d..69b6ad51d6339af2c11e06583029ae733fbc60cd 100644 (file)
@@ -1,3 +1,8 @@
+2011-03-11  Richard Guenther  <rguenther@suse.de>
+
+       PR lto/48073
+       * g++.dg/lto/20110311-1_0.C: New testcase.
+
 2011-03-11  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/48035
diff --git a/gcc/testsuite/g++.dg/lto/20110311-1_0.C b/gcc/testsuite/g++.dg/lto/20110311-1_0.C
new file mode 100644 (file)
index 0000000..c63951e
--- /dev/null
@@ -0,0 +1,51 @@
+/* { dg-lto-do link } */
+/* { dg-extra-ld-options "-r -nostdlib" } */
+
+struct NullType {};
+
+template <class T, class U>
+struct TList
+{
+    typedef T Head;
+    typedef U Tail;
+};
+
+template <class T>
+struct TListLength {};
+
+template <class T, class U>
+struct TListLength<TList<T,U> >
+{
+    enum
+    {
+        Ret = 1 + TListLength<U>::Ret
+    };
+};
+
+template <>
+struct TListLength<NullType>
+{
+    enum
+    {
+        Ret = 0
+    };
+};
+
+template <class Moves>
+class DDQMC
+{
+public:
+    int* moves[TListLength<Moves>::Ret];
+    inline DDQMC();
+private:
+};
+
+template <class Moves>
+DDQMC<Moves>::DDQMC()
+{
+}
+
+int main()
+{
+    typedef DDQMC< TList<float, TList<int, NullType> > > mytype;
+}
index d923ac89a766146369c8957efa1ad8d587e0fee6..be469909995b090bc506eb16dcc3f3b01e417479 100644 (file)
@@ -4822,7 +4822,8 @@ find_decls_types_r (tree *tp, int *ws, void *data)
       fld_worklist_push (BLOCK_ABSTRACT_ORIGIN (t), fld);
     }
 
-  fld_worklist_push (TREE_TYPE (t), fld);
+  if (TREE_CODE (t) != IDENTIFIER_NODE)
+    fld_worklist_push (TREE_TYPE (t), fld);
 
   return NULL_TREE;
 }