summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/test/tasking
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/test/tasking
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/test/tasking')
-rw-r--r--openmp/runtime/test/tasking/bug_36720.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/openmp/runtime/test/tasking/bug_36720.c b/openmp/runtime/test/tasking/bug_36720.c
new file mode 100644
index 00000000000..059d9c94697
--- /dev/null
+++ b/openmp/runtime/test/tasking/bug_36720.c
@@ -0,0 +1,34 @@
+// RUN: %libomp-compile-and-run
+
+/*
+Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=36720
+
+Assertion failure at kmp_runtime.cpp(1715): nthreads > 0.
+OMP: Error #13: Assertion failure at kmp_runtime.cpp(1715).
+
+The assertion fails even with OMP_NUM_THREADS=1. If the second task is removed,
+everything runs to completion. If the "omp parallel for" directives are removed
+from inside the tasks, once again everything runs fine.
+*/
+
+#define N 1024
+
+int main() {
+ #pragma omp task
+ {
+ #pragma omp parallel for
+ for (int i = 0; i < N; i++)
+ (void)0;
+ }
+
+ #pragma omp task
+ {
+ #pragma omp parallel for
+ for (int i = 0; i < N; ++i)
+ (void)0;
+ }
+
+ #pragma omp taskwait
+
+ return 0;
+}
OpenPOWER on IntegriCloud