summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2018-07-30 21:47:56 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2018-07-30 21:47:56 +0000
commit28226e7d64df6f5c99fca296533007e79abf6930 (patch)
treebe4aa7c9388503b61f41ae902d47b66baa723edd /openmp/runtime/src
parentf44b9070b91c21c3d773485c3a557b9fc68dde53 (diff)
downloadbcm5719-llvm-28226e7d64df6f5c99fca296533007e79abf6930.tar.gz
bcm5719-llvm-28226e7d64df6f5c99fca296533007e79abf6930.zip
[OpenMP] Fix tasking + parallel bug
From the bug report, the runtime needs to initialize the nproc variables (inside middle init) for each root when the task is encountered, otherwise, a segfault can occur. Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=36720 Differential Revision: https://reviews.llvm.org/D49996 llvm-svn: 338313
Diffstat (limited to 'openmp/runtime/src')
-rw-r--r--openmp/runtime/src/kmp_tasking.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/openmp/runtime/src/kmp_tasking.cpp b/openmp/runtime/src/kmp_tasking.cpp
index 5daca2837cf..8ed6afea542 100644
--- a/openmp/runtime/src/kmp_tasking.cpp
+++ b/openmp/runtime/src/kmp_tasking.cpp
@@ -1025,6 +1025,9 @@ kmp_task_t *__kmp_task_alloc(ident_t *loc_ref, kmp_int32 gtid,
kmp_taskdata_t *parent_task = thread->th.th_current_task;
size_t shareds_offset;
+ if (!TCR_4(__kmp_init_middle))
+ __kmp_middle_initialize();
+
KA_TRACE(10, ("__kmp_task_alloc(enter): T#%d loc=%p, flags=(0x%x) "
"sizeof_task=%ld sizeof_shared=%ld entry=%p\n",
gtid, loc_ref, *((kmp_int32 *)flags), sizeof_kmp_task_t,
OpenPOWER on IntegriCloud