OSDN Git Service

2010-07-21 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 21 Jul 2010 15:09:00 +0000 (15:09 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 21 Jul 2010 15:09:00 +0000 (15:09 +0000)
PR lto/45018
* tree.c (find_decls_types_r): Do not follow TREE_CHAIN
of TYPE_DECLs.  Do not follow TYPE_NEXT_VARIANT,
TYPE_NEXT_PTR_TO, nor TYPE_NEXT_REF_TO or TYPE_CANONICAL.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162380 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 517ff74..e4dbeb6 100644 (file)
@@ -1,3 +1,10 @@
+2010-07-21  Richard Guenther  <rguenther@suse.de>
+
+       PR lto/45018
+       * tree.c (find_decls_types_r): Do not follow TREE_CHAIN
+       of TYPE_DECLs.  Do not follow TYPE_NEXT_VARIANT,
+       TYPE_NEXT_PTR_TO, nor TYPE_NEXT_REF_TO or TYPE_CANONICAL.
+
 2010-07-21  Martin Jambor  <mjambor@suse.cz>
 
        PR tree-optimization/44900
index a6555a8..136ef6e 100644 (file)
@@ -1,3 +1,8 @@
+2010-07-21  Richard Guenther  <rguenther@suse.de>
+
+       PR lto/45018
+       * g++.dg/lto/20100721-1_0.C: New testcase.
+
 2010-07-21  Martin Jambor  <mjambor@suse.cz>
 
        PR tree-optimization/44900
diff --git a/gcc/testsuite/g++.dg/lto/20100721-1_0.C b/gcc/testsuite/g++.dg/lto/20100721-1_0.C
new file mode 100644 (file)
index 0000000..09132e5
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-lto-do assemble } */
+
+static inline int __gthread_active_p (void) { }
+template <int rank, int dim> class Tensor;
+template <int dimension> struct G;
+template <int dim> class T {
+    typedef void A;
+    typedef Tensor<1,dim> F[G<dim>::v];
+};
index aab4cfe..a33f22b 100644 (file)
@@ -4704,7 +4704,8 @@ find_decls_types_r (tree *tp, int *ws, void *data)
          && DECL_HAS_VALUE_EXPR_P (t))
        fld_worklist_push (DECL_VALUE_EXPR (t), fld);
 
-      if (TREE_CODE (t) != FIELD_DECL)
+      if (TREE_CODE (t) != FIELD_DECL
+         && TREE_CODE (t) != TYPE_DECL)
        fld_worklist_push (TREE_CHAIN (t), fld);
       *ws = 0;
     }
@@ -4722,13 +4723,19 @@ find_decls_types_r (tree *tp, int *ws, void *data)
       fld_worklist_push (TYPE_POINTER_TO (t), fld);
       fld_worklist_push (TYPE_REFERENCE_TO (t), fld);
       fld_worklist_push (TYPE_NAME (t), fld);
-      fld_worklist_push (TYPE_MINVAL (t), fld);
+      /* Do not walk TYPE_NEXT_PTR_TO or TYPE_NEXT_REF_TO.  We do not stream
+        them and thus do not and want not to reach unused pointer types
+        this way.  */
+      if (!POINTER_TYPE_P (t))
+       fld_worklist_push (TYPE_MINVAL (t), fld);
       if (!RECORD_OR_UNION_TYPE_P (t))
        fld_worklist_push (TYPE_MAXVAL (t), fld);
       fld_worklist_push (TYPE_MAIN_VARIANT (t), fld);
-      fld_worklist_push (TYPE_NEXT_VARIANT (t), fld);
+      /* Do not walk TYPE_NEXT_VARIANT.  We do not stream it and thus
+         do not and want not to reach unused variants this way.  */
       fld_worklist_push (TYPE_CONTEXT (t), fld);
-      fld_worklist_push (TYPE_CANONICAL (t), fld);
+      /* Do not walk TYPE_CANONICAL.  We do not stream it and thus do not
+        and want not to reach unused types this way.  */
 
       if (RECORD_OR_UNION_TYPE_P (t) && TYPE_BINFO (t))
        {