aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
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/testsuite
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/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cilk-plus/CK/pr80038.cc47
2 files changed, 52 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index dc80b56..205c083 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-05-01 Xi Ruoyao <ryxi@stu.xidian.edu.cn>
+
+ PR c++/80038
+ * g++.dg/cilk-plus/CK/pr80038.cc: New test.
+
2017-05-01 David Malcolm <dmalcolm@redhat.com>
* gcc.dg/Wmissing-braces-fixits.c: Update expected output to
diff --git a/gcc/testsuite/g++.dg/cilk-plus/CK/pr80038.cc b/gcc/testsuite/g++.dg/cilk-plus/CK/pr80038.cc
new file mode 100644
index 0000000..85990e5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cilk-plus/CK/pr80038.cc
@@ -0,0 +1,47 @@
+/* { dg-options "-fcilkplus" } */
+/* { dg-do run } */
+/* { dg-require-effective-target cilkplus_runtime } */
+
+#include <unistd.h>
+extern "C" {
+ extern int __cilkrts_set_param (const char *, const char *);
+}
+
+int objcnt = 0;
+
+struct foo
+{
+ int live;
+ foo ()
+ { objcnt++; }
+ foo (const foo &)
+ { objcnt++; }
+ ~foo ()
+ { objcnt--; }
+};
+
+void
+spawnee (foo f)
+{
+ usleep(2000);
+ /* Now both my_test::f and spawnee::f should be alive. */
+ if (objcnt != 2)
+ __builtin_abort ();
+}
+
+void
+my_test ()
+{
+ foo f;
+ _Cilk_spawn spawnee (f);
+ _Cilk_sync ;
+}
+
+int
+main ()
+{
+ if (__cilkrts_set_param ("nworkers", "2") != 0)
+ __builtin_abort ();
+
+ my_test ();
+}