]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[cilkplus] Fix cilk_spawn gimplification bug (PR cilkplus/69048)
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 14 Jan 2016 22:23:09 +0000 (22:23 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 14 Jan 2016 22:23:09 +0000 (22:23 +0000)
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.

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

gcc/c-family/ChangeLog
gcc/c-family/cilk.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cilk-plus/CK/pr69048.cc [new file with mode: 0644]

index e3b9654c85b0f64161706d617ade7cf800c21d8d..af215511546e3c33fe8cf63410f09497dc7c7cff 100644 (file)
@@ -1,3 +1,9 @@
+2015-01-14 Ryan Burn  <contact@rnburn.com>
+
+       PR c++/69048
+       * cilk.c (create_cilk_wrapper_body): Call fold_build_cleanup_point_expr
+        to add missing cleanup point.
+
 2016-01-14  David Malcolm  <dmalcolm@redhat.com>
 
        PR c++/68819
index 57dfa4120a54d81c5608ba789c7d53ea9fe963bb..4d6be33d818e35acb45eb502adf9e00d909ffed3 100644 (file)
@@ -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));
index d2ad41c415503212906b32ed5d670688231ffc96..05ae50bb69ab3ffcab432a87ac8920bd4bc35553 100644 (file)
@@ -1,3 +1,8 @@
+2015-01-14 Ryan Burn  <contact@rnburn.com>
+
+       PR c++/69048
+       * g++.dg/cilk-plus/CK/pr69048.cc: New test.
+
 2016-01-14  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        PR testsuite/67509
diff --git a/gcc/testsuite/g++.dg/cilk-plus/CK/pr69048.cc b/gcc/testsuite/g++.dg/cilk-plus/CK/pr69048.cc
new file mode 100644 (file)
index 0000000..b6c57fc
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+struct A {
+  ~A () {}
+};
+
+A f () {
+  return A ();
+}
+
+void t1 () {
+  _Cilk_spawn f ();
+}