aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalaji V. Iyer <balaji.v.iyer@intel.com>2012-12-29 01:19:49 +0000
committerBalaji V. Iyer <balaji.v.iyer@intel.com>2012-12-29 01:19:49 +0000
commita1605f8b17687ced219a0384bb005abd1bb6e4d0 (patch)
treeb66b6417730b95846a69ecb9f7f96e433f10a047
parente3e551a667a641fadf4a67dabe48deb78d91c446 (diff)
Fixed a seg-fault on libcilkrts.
+2012-12-28 Balaji V. Iyer <balaji.v.iyer@intel.com> + + * runtime/cilk-abi-cilk-for.cpp (capture_spawn_arg_stack_frame): Added + #ifdefs to check compiler type between the function's body. + git-svn-id: https://gcc.gnu.org/svn/gcc/branches/cilkplus@194750 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libcilkrts/ChangeLog.cilkplus5
-rw-r--r--libcilkrts/runtime/cilk-abi-cilk-for.cpp17
2 files changed, 20 insertions, 2 deletions
diff --git a/libcilkrts/ChangeLog.cilkplus b/libcilkrts/ChangeLog.cilkplus
index 0903be511b6..001e9636731 100644
--- a/libcilkrts/ChangeLog.cilkplus
+++ b/libcilkrts/ChangeLog.cilkplus
@@ -1,3 +1,8 @@
+2012-12-28 Balaji V. Iyer <balaji.v.iyer@intel.com>
+
+ * runtime/cilk-abi-cilk-for.cpp (capture_spawn_arg_stack_frame): Added
+ #ifdefs to check compiler type between the function's body.
+
2012-12-06 Balaji V. Iyer <balaji.v.iyer@intel.com>
* include/cilk/reduce_min.h: Updated to revision 2856.
diff --git a/libcilkrts/runtime/cilk-abi-cilk-for.cpp b/libcilkrts/runtime/cilk-abi-cilk-for.cpp
index 373ebb16b9f..a584f86c2ca 100644
--- a/libcilkrts/runtime/cilk-abi-cilk-for.cpp
+++ b/libcilkrts/runtime/cilk-abi-cilk-for.cpp
@@ -182,13 +182,26 @@ void call_cilk_for_loop_body(count_t low, count_t high,
inline __cilkrts_worker*
capture_spawn_arg_stack_frame(__cilkrts_stack_frame* &sf, __cilkrts_worker* w)
{
+ // Get current stack frame
+ sf = w->current_stack_frame;
+#ifdef __INTEL_COMPILER
+# if __INTEL_COMPILER <= 1300 && __INTEL_COMPILER_BUILD_DATE < 20130101
+ // In older compilers 'w->current_stack_frame' points to the
+ // spawn-helper's stack frame. In newer compiler's however, it points
+ // directly to the pointer's stack frame. (This change was made to avoid
+ // having the spawn helper in the frame list when evaluating function
+ // arguments, thus avoiding corruption when those arguments themselves
+ // contain cilk_spawns.)
+
// w->current_stack_frame is the spawn helper's stack frame.
// w->current_stack_frame->call_parent is the caller's stack frame.
- // return w->current_stack_frame->call_parent;
- sf = w->current_stack_frame->call_parent;
+ sf = sf->call_parent;
+# endif
+#endif
return w;
}
+
/*
* cilk_for_recursive
*