aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/cilk.c
diff options
context:
space:
mode:
authorRyan Burn <contact@rnburn.com>2016-01-14 22:23:09 +0000
committerJeff Law <law@gcc.gnu.org>2016-01-14 15:23:09 -0700
commitb6e3db0608604ddd93b77b42a598e1d0b2d6efd1 (patch)
tree5123b2c42371f63149c2fe16f954433caa95578f /gcc/c-family/cilk.c
parent006df05d5cc462545336d5a439afbf10732acd16 (diff)
downloadgcc-b6e3db0608604ddd93b77b42a598e1d0b2d6efd1.zip
gcc-b6e3db0608604ddd93b77b42a598e1d0b2d6efd1.tar.gz
gcc-b6e3db0608604ddd93b77b42a598e1d0b2d6efd1.tar.bz2
[cilkplus] Fix cilk_spawn gimplification bug (PR cilkplus/69048)
PR c++/69048 * cilk.c (create_cilk_wrapper_body): Call fold_build_cleanup_point_expr to add missing cleanup point. PR c++/69048 * g++.dg/cilk-plus/CK/pr69048.cc: New test. From-SVN: r232393
Diffstat (limited to 'gcc/c-family/cilk.c')
-rw-r--r--gcc/c-family/cilk.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/c-family/cilk.c b/gcc/c-family/cilk.c
index 57dfa41..4d6be33 100644
--- a/gcc/c-family/cilk.c
+++ b/gcc/c-family/cilk.c
@@ -592,6 +592,11 @@ create_cilk_wrapper_body (tree stmt, struct wrapper_data *wd)
for (p = wd->parms; p; p = TREE_CHAIN (p))
DECL_CONTEXT (p) = fndecl;
+ /* The statement containing the spawn expression might create temporaries with
+ destructors defined; if so we need to add a CLEANUP_POINT_EXPR to ensure
+ the expression is properly gimplified. */
+ stmt = fold_build_cleanup_point_expr (void_type_node, stmt);
+
gcc_assert (!DECL_SAVED_TREE (fndecl));
cilk_install_body_with_frame_cleanup (fndecl, stmt, (void *) wd);
gcc_assert (DECL_SAVED_TREE (fndecl));