aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cp-gimplify.c
diff options
context:
space:
mode:
authorXi Ruoyao <ryxi@stu.xidian.edu.cn>2017-05-01 22:26:02 +0000
committerJeff Law <law@gcc.gnu.org>2017-05-01 16:26:02 -0600
commit815d9cc6641a3eeb6734a98f64ea8b183a495ee5 (patch)
treea8a033d722da210460642c7a397ad087d9c87d1f /gcc/cp/cp-gimplify.c
parent338035aa194405df94875cebb389d593cf9ef00a (diff)
downloadgcc-815d9cc6641a3eeb6734a98f64ea8b183a495ee5.zip
gcc-815d9cc6641a3eeb6734a98f64ea8b183a495ee5.tar.gz
gcc-815d9cc6641a3eeb6734a98f64ea8b183a495ee5.tar.bz2
re PR c++/80038 (Random segfault using local vectors in Cilk function)
2017-05-01 Xi Ruoyao <ryxi@stu.xidian.edu.cn> PR c++/80038 * cilk_common.c (expand_builtin_cilk_detach): Move pedigree operations here. * gimplify.c (gimplify_cilk_detach): New function. (gimplify_call_expr, gimplify_modify_expr): Call it as needed. * tree-core.h: Document EXPR_CILK_SPAWN. * tree.h (EXPR_CILK_SPAWN): Define. PR c++/80038 * c-common.h (cilk_gimplify_call_params_in_spawned_fn): Remove prototype. (cilk_install_body_pedigree_operations): Likewise. * cilk.c (cilk_set_spawn_marker): Mark functions that should be detatched. (cilk_gimplify_call_params_in_spawned_fn): Remove. (cilk_install_body_pedigree_operations): Likewise. (gimplify_cilk_spawn): Add EXPR_STMT and CLEANUP_POINT_EXPR unwrapping. PR c++/80038 * c-gimplify.c (c_gimplify_expr): Remove calls to cilk_gimplifY_call_params_in_spawned_fn. PR c++/80038 * cp-cilkplus.c (cilk_install_body_with_frame_cleanup): Don't add pedigree operation and detach call here. * cp-gimplify.c (cp_gimplify_expr): Remove the calls to cilk_cp_gimplify_call_params_in_spawned_fn. (cilk_cp_gimplify_call_params_in_spawned_fn): Remove function. * semantics.c (simplify_aggr_init_expr): Copy EXPR_CILK_SPAWN. PR c++/80038 * lto-lang.c (lto_init): Set in_lto_p earlier. PR c++/80038 * g++.dg/cilk-plus/CK/pr80038.cc: New test. From-SVN: r247446
Diffstat (limited to 'gcc/cp/cp-gimplify.c')
-rw-r--r--gcc/cp/cp-gimplify.c40
1 files changed, 4 insertions, 36 deletions
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index f2c5296..de62414 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -88,25 +88,6 @@ finish_bc_block (tree *block, enum bc_t bc, tree label)
DECL_CHAIN (label) = NULL_TREE;
}
-/* This function is a wrapper for cilk_gimplify_call_params_in_spawned_fn.
- *EXPR_P can be a CALL_EXPR, INIT_EXPR, MODIFY_EXPR, AGGR_INIT_EXPR or
- TARGET_EXPR. *PRE_P and *POST_P are gimple sequences from the caller
- of gimplify_cilk_spawn. */
-
-static void
-cilk_cp_gimplify_call_params_in_spawned_fn (tree *expr_p, gimple_seq *pre_p,
- gimple_seq *post_p)
-{
- int ii = 0;
-
- cilk_gimplify_call_params_in_spawned_fn (expr_p, pre_p);
- if (TREE_CODE (*expr_p) == AGGR_INIT_EXPR)
- for (ii = 0; ii < aggr_init_expr_nargs (*expr_p); ii++)
- gimplify_expr (&AGGR_INIT_EXPR_ARG (*expr_p, ii), pre_p, post_p,
- is_gimple_reg, fb_rvalue);
-}
-
-
/* Get the LABEL_EXPR to represent a break or continue statement
in the current block scope. BC indicates which. */
@@ -647,11 +628,7 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
if (fn_contains_cilk_spawn_p (cfun))
{
if (cilk_cp_detect_spawn_and_unwrap (expr_p))
- {
- cilk_cp_gimplify_call_params_in_spawned_fn (expr_p,
- pre_p, post_p);
- return (enum gimplify_status) gimplify_cilk_spawn (expr_p);
- }
+ return (enum gimplify_status) gimplify_cilk_spawn (expr_p);
if (seen_error () && contains_cilk_spawn_stmt (*expr_p))
return GS_ERROR;
}
@@ -666,10 +643,7 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
if (fn_contains_cilk_spawn_p (cfun)
&& cilk_cp_detect_spawn_and_unwrap (expr_p)
&& !seen_error ())
- {
- cilk_cp_gimplify_call_params_in_spawned_fn (expr_p, pre_p, post_p);
- return (enum gimplify_status) gimplify_cilk_spawn (expr_p);
- }
+ return (enum gimplify_status) gimplify_cilk_spawn (expr_p);
/* If the back end isn't clever enough to know that the lhs and rhs
types are the same, add an explicit conversion. */
tree op0 = TREE_OPERAND (*expr_p, 0);
@@ -787,20 +761,14 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
&& cilk_cp_detect_spawn_and_unwrap (expr_p));
if (!seen_error ())
- {
- cilk_cp_gimplify_call_params_in_spawned_fn (expr_p, pre_p, post_p);
- return (enum gimplify_status) gimplify_cilk_spawn (expr_p);
- }
+ return (enum gimplify_status) gimplify_cilk_spawn (expr_p);
return GS_ERROR;
case CALL_EXPR:
if (fn_contains_cilk_spawn_p (cfun)
&& cilk_cp_detect_spawn_and_unwrap (expr_p)
&& !seen_error ())
- {
- cilk_cp_gimplify_call_params_in_spawned_fn (expr_p, pre_p, post_p);
- return (enum gimplify_status) gimplify_cilk_spawn (expr_p);
- }
+ return (enum gimplify_status) gimplify_cilk_spawn (expr_p);
ret = GS_OK;
if (!CALL_EXPR_FN (*expr_p))
/* Internal function call. */;