summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/test/tasking/hidden_helper_task/single_helper_thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'openmp/runtime/test/tasking/hidden_helper_task/single_helper_thread.c')
-rw-r--r--openmp/runtime/test/tasking/hidden_helper_task/single_helper_thread.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/openmp/runtime/test/tasking/hidden_helper_task/single_helper_thread.c b/openmp/runtime/test/tasking/hidden_helper_task/single_helper_thread.c
new file mode 100644
index 000000000000..a1aeda76e22f
--- /dev/null
+++ b/openmp/runtime/test/tasking/hidden_helper_task/single_helper_thread.c
@@ -0,0 +1,21 @@
+// RUN: %libomp-compile && env LIBOMP_NUM_HIDDEN_HELPER_THREADS=1 %libomp-run
+
+// The test checks that "devide-by-0" bug fixed in runtime.
+// The fix is to increment number of threads by 1 if positive,
+// so that operation
+// (gtid) % (__kmp_hidden_helper_threads_num - 1)
+// does not cause crash.
+
+#include <stdio.h>
+#include <omp.h>
+
+int main(){
+#pragma omp target nowait
+ {
+ printf("----- in target region\n");
+ }
+ printf("------ before taskwait\n");
+#pragma omp taskwait
+ printf("passed\n");
+ return 0;
+}