From: Jakub Jelinek Date: Mon, 18 Jul 2016 18:45:18 +0000 (+0200) Subject: re PR c++/70869 (internal compiler error: Segmentation fault on array of pointer... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e43ebb1268899ccce28383a361b947493a4f452c;p=gcc.git re PR c++/70869 (internal compiler error: Segmentation fault on array of pointer to function members) 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9fa2f3a87d5..c88b98cbf1b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,12 @@ 2016-07-18 Jakub Jelinek + 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. diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index de6c9296aa8..41ab35f8ede 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -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 diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 4cbf6215a13..faf096c5c9b 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -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; }