2 /* { dg-set-target-env-var OMP_CANCELLATION "true" } */
7 __attribute__((noinline
, noclone
)) int
11 #pragma omp parallel num_threads (32) shared (v, w)
15 for (i
= 0; i
< 1000; ++i
)
17 #pragma omp cancel for if (x[0])
21 for (i
= 0; i
< 1000; ++i
)
23 #pragma omp cancel for if (x[1])
28 for (i
= 0; i
< 1000; ++i
)
30 #pragma omp cancel for if (x[2])
35 for (i
= 0; i
< 1000; ++i
)
37 #pragma omp cancel for if (x[3])
42 if (v
!= 3000 || w
!= 0)
44 #pragma omp parallel num_threads (32) shared (v, w)
47 /* None of these cancel directives should actually cancel anything,
48 but the compiler shouldn't know that and thus should use cancellable
49 barriers at the end of all the workshares. */
50 #pragma omp cancel parallel if (omp_get_thread_num () == 1 && x[4])
52 for (i
= 0; i
< 1000; ++i
)
54 #pragma omp cancel for if (x[0])
57 #pragma omp cancel parallel if (omp_get_thread_num () == 2 && x[4])
59 for (i
= 0; i
< 1000; ++i
)
61 #pragma omp cancel for if (x[1])
65 #pragma omp cancel parallel if (omp_get_thread_num () == 3 && x[4])
67 for (i
= 0; i
< 1000; ++i
)
69 #pragma omp cancel for if (x[2])
73 #pragma omp cancel parallel if (omp_get_thread_num () == 4 && x[4])
75 for (i
= 0; i
< 1000; ++i
)
77 #pragma omp cancel for if (x[3])
81 #pragma omp cancel parallel if (omp_get_thread_num () == 5 && x[4])
83 if (v
!= 6000 || w
!= 0)
91 int x
[] = { 1, 0, 1, 0, 0 };
92 if (omp_get_cancellation ())