On 08/31/2015 06:04 PM, Iyer, Balaji V wrote:
Hello Everyone,
This patch will fix the bug reported in Bugzilla, PR 60586. The issue
was that the spawned function's function arguments must not be pushed into the
nested/lambda function. This patch should fix that issue.
I have tested this on x86_64 (linux and Cygwin flavors). Is this OK for trunk?
Here are the Changelog entries:
gcc/c-family/ChangeLog
2015-08-31 Balaji V. Iyer<balaji.v.i...@intel.com>
PR middle-end/60586
* c-common.h: Added two more parameters to the gimplify_cilk_spawn
function.
* c-gimplify.c (c_gimplify_expr): Likewise.
* cilk.c (gimplify_cilk_spawn): Likewise and called
gimplify_call_params_in_spawned_fn.
(gimplify_call_params_in_spawned_fn): New function.
gcc/cp/ChangeLog
2015-08-31 Balaji V. Iyer<balaji.v.i...@intel.com>
PR middle-end/60586
* cp-gimplify.c (cp_gimplify_expr): Added two additional parameters to
gimplify_cilk_spawn.
gcc/testsuite/ChangeLog
2015-08-31 Balaji V. Iyer<balaji.v.i...@intel.com>
PR middle-end/60586
* c-c++-common/cilk-plus/CK/pr60586.c: New file.
* g++.dg/cilk-plus/CK/pr60586.cc: Likewise.
Thanks,
Balaji V. Iyer.
diff.txt
diff --git a/gcc/c-family/cilk.c b/gcc/c-family/cilk.c
index 1012a4f..1fe6685 100644
--- a/gcc/c-family/cilk.c
+++ b/gcc/c-family/cilk.c
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimplify.h"
#include "tree-iterator.h"
#include "tree-inline.h"
+#include "cp/cp-tree.h"
Presumably you needed this for AGGR_INIT_EXPR. I believe you need to
refactor the code a bit -- including a C++ front-end header file into
something in c-family seems wrong.
While it may not break in this specific instance, but it is a modularity
violation.
#include "c-family/c-common.h"
#include "toplev.h"
#include "tm.h"
@@ -762,12 +763,37 @@ create_cilk_wrapper (tree exp, tree *args_out)
return fndecl;
}
+/* Gimplify all the parameters for the Spawned function. *EXPR_P can be a
+ CALL_EXPR, INIT_EXPR, MODIFY_EXPR or TARGET_EXPR. *PRE_P and *POST_P are
+ gimple sequences from the caller of gimplify_cilk_spawn. */
Comment doesn't match the code, code also checks for AGGR_INIT_EXPR.
Given the dependency on AGGR_INIT_EXPR, it seems this checking somehow
needs to move into the front-ends.
I think once that's fixed this ought to be ready for the trunk.
jeff