PR rtl-optimization/77919
[official-gcc.git] / libgomp / testsuite / libgomp.c / cancel-parallel-3.c
blob7ceaed1846753f717e7a3c08d82508ec62bb3c0b
1 /* { dg-do run } */
2 /* { dg-set-target-env-var OMP_CANCELLATION "true" } */
4 #include <omp.h>
5 #include <unistd.h>
7 static inline void
8 do_some_work (void)
10 asm volatile ("" : : : "memory");
13 int
14 main ()
16 omp_set_dynamic (0);
17 omp_set_schedule (omp_sched_static, 1);
18 #pragma omp parallel num_threads (16)
20 int i, j;
21 do_some_work ();
22 #pragma omp barrier
23 if (omp_get_thread_num () == 1)
25 sleep (2);
26 #pragma omp cancellation point parallel
28 for (j = 3; j <= 16; j++)
29 #pragma omp for schedule (runtime) nowait
30 for (i = 0; i < j; i++)
31 do_some_work ();
32 if (omp_get_thread_num () == 0)
34 sleep (1);
35 #pragma omp cancel parallel
38 return 0;