xref: /llvm-project/openmp/runtime/test/tasking/hidden_helper_task/single_helper_thread.c (revision fe7f620ed6e30015267d131bb753fd408bb3dd8c)
1 // RUN: %libomp-compile && env LIBOMP_NUM_HIDDEN_HELPER_THREADS=1 %libomp-run
2 
3 // gcc/icc target offloading is incompatible with libomp
4 // UNSUPPORTED: icc, gcc
5 
6 // The test checks that "devide-by-0" bug fixed in runtime.
7 // The fix is to increment number of threads by 1 if positive,
8 // so that operation
9 //   (gtid) % (__kmp_hidden_helper_threads_num - 1)
10 // does not cause crash.
11 
12 #include <stdio.h>
13 #include <omp.h>
14 
main()15 int main(){
16 #pragma omp target nowait
17    {
18       printf("----- in  target region\n");
19    }
20   printf("------ before taskwait\n");
21 #pragma omp taskwait
22   printf("passed\n");
23   return 0;
24 }
25