summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src/z_Linux_util.c
diff options
context:
space:
mode:
authorAndrey Churbanov <Andrey.Churbanov@intel.com>2015-08-05 11:12:45 +0000
committerAndrey Churbanov <Andrey.Churbanov@intel.com>2015-08-05 11:12:45 +0000
commit368b70ef9586b901082eb002e3b39e625872aa7e (patch)
tree1127be97eefd1c693fd329c5866e2db3d27e177a /openmp/runtime/src/z_Linux_util.c
parent6fbef2a780fe356fbe1cb3abfe7daa6d0da05fef (diff)
downloadbcm5719-llvm-368b70ef9586b901082eb002e3b39e625872aa7e.tar.gz
bcm5719-llvm-368b70ef9586b901082eb002e3b39e625872aa7e.zip
D11159: Fixing the stack offset functionality
llvm-svn: 244030
Diffstat (limited to 'openmp/runtime/src/z_Linux_util.c')
-rw-r--r--openmp/runtime/src/z_Linux_util.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/openmp/runtime/src/z_Linux_util.c b/openmp/runtime/src/z_Linux_util.c
index 9f34d3460ea..133a5fe8007 100644
--- a/openmp/runtime/src/z_Linux_util.c
+++ b/openmp/runtime/src/z_Linux_util.c
@@ -684,7 +684,7 @@ __kmp_launch_worker( void *thr )
#endif /* KMP_BLOCK_SIGNALS */
void *exit_val;
#if KMP_OS_LINUX || KMP_OS_FREEBSD
- void *padding = 0;
+ void * volatile padding = 0;
#endif
int gtid;
@@ -1012,8 +1012,13 @@ __kmp_create_worker( int gtid, kmp_info_t *th, size_t stack_size )
);
}; // if
- /* Set stack size for this thread now. */
- stack_size += gtid * __kmp_stkoffset;
+ /* Set stack size for this thread now.
+ * The multiple of 2 is there because on some machines, requesting an unusual stacksize
+ * causes the thread to have an offset before the dummy alloca() takes place to create the
+ * offset. Since we want the user to have a sufficient stacksize AND support a stack offset, we
+ * alloca() twice the offset so that the upcoming alloca() does not eliminate any premade
+ * offset, and also gives the user the stack space they requested for all threads */
+ stack_size += gtid * __kmp_stkoffset * 2;
KA_TRACE( 10, ( "__kmp_create_worker: T#%d, default stacksize = %lu bytes, "
"__kmp_stksize = %lu bytes, final stacksize = %lu bytes\n",
OpenPOWER on IntegriCloud