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