re PR c++/70869 (internal compiler error: Segmentation fault on array of pointer...
authorJakub Jelinek <jakub@redhat.com>
Mon, 18 Jul 2016 18:45:18 +0000 (20:45 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 18 Jul 2016 18:45:18 +0000 (20:45 +0200)
PR c++/70869
PR c++/71054
* cp-gimplify.c (cp_genericize_r): Revert the 2016-07-07 change.
* tree.c (cp_walk_subtrees): For DECL_EXPR on DECL_ARTIFICIAL
non-static VAR_DECL, walk the decl's DECL_INITIAL, DECL_SIZE and
DECL_SIZE_UNIT.

From-SVN: r238444

gcc/cp/ChangeLog
gcc/cp/cp-gimplify.c
gcc/cp/tree.c

index 9fa2f3a87d50a46f81d177def28b625d12090075..c88b98cbf1b0ab1617f29d01e2239c6daf61df3e 100644 (file)
@@ -1,5 +1,12 @@
 2016-07-18  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/70869
+       PR c++/71054
+       * cp-gimplify.c (cp_genericize_r): Revert the 2016-07-07 change.
+       * tree.c (cp_walk_subtrees): For DECL_EXPR on DECL_ARTIFICIAL
+       non-static VAR_DECL, walk the decl's DECL_INITIAL, DECL_SIZE and
+       DECL_SIZE_UNIT.
+
        PR c++/71835
        * call.c (build_op_call_1): Use convert_like_with_context only
        if cand->fn is a decl.
index de6c9296aa83d08d0abe7d488d02d4ad95afa9f6..41ab35f8ede03c119fb4bd0aa0aad5571edd3dd9 100644 (file)
@@ -1351,15 +1351,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
     {
       tree d = DECL_EXPR_DECL (stmt);
       if (TREE_CODE (d) == VAR_DECL)
-       {
-         gcc_assert (CP_DECL_THREAD_LOCAL_P (d) == DECL_THREAD_LOCAL_P (d));
-         /* User var initializers should be genericized during containing
-            BIND_EXPR genericization when walk_tree walks DECL_INITIAL
-            of BIND_EXPR_VARS.  Artificial temporaries might not be
-            mentioned there though, so walk them now.  */
-         if (DECL_ARTIFICIAL (d) && !TREE_STATIC (d) && DECL_INITIAL (d))
-           cp_walk_tree (&DECL_INITIAL (d), cp_genericize_r, data, NULL);
-       }
+       gcc_assert (CP_DECL_THREAD_LOCAL_P (d) == DECL_THREAD_LOCAL_P (d));
     }
   else if (TREE_CODE (stmt) == OMP_PARALLEL
           || TREE_CODE (stmt) == OMP_TASK
index 4cbf6215a13a294e911f8737f62f2c5a46aa927e..faf096c5c9be9d6cc2fb1a1276c9393b3a9d4754 100644 (file)
@@ -4075,6 +4075,22 @@ cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func,
       *walk_subtrees_p = 0;
       break;
 
+    case DECL_EXPR:
+      /* User variables should be mentioned in BIND_EXPR_VARS
+        and their initializers and sizes walked when walking
+        the containing BIND_EXPR.  Compiler temporaries are
+        handled here.  */
+      if (VAR_P (TREE_OPERAND (*tp, 0))
+         && DECL_ARTIFICIAL (TREE_OPERAND (*tp, 0))
+         && !TREE_STATIC (TREE_OPERAND (*tp, 0)))
+       {
+         tree decl = TREE_OPERAND (*tp, 0);
+         WALK_SUBTREE (DECL_INITIAL (decl));
+         WALK_SUBTREE (DECL_SIZE (decl));
+         WALK_SUBTREE (DECL_SIZE_UNIT (decl));
+       }
+      break;
+
     default:
       return NULL_TREE;
     }