xfail scan-tree-dump-not throw in g++.dg/pr99966.C on hppa*64*-*-*
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / cancel-taskgroup-3.c
blob9e07cc10b6563f6ab8415363b9042c6d650a98f2
1 /* { dg-do run { target tls_runtime } } */
2 /* { dg-set-target-env-var OMP_CANCELLATION "true" } */
4 #include <stdlib.h>
5 #include <omp.h>
7 int t;
8 #pragma omp threadprivate (t)
10 int
11 main ()
13 int a = 0, i;
14 #pragma omp parallel
15 #pragma omp taskgroup
17 #pragma omp task
19 #pragma omp cancel taskgroup
20 if (omp_get_cancellation ())
21 abort ();
23 #pragma omp taskwait
24 #pragma omp for reduction (task, +: a)
25 for (i = 0; i < 64; ++i)
27 a++;
28 #pragma omp task in_reduction (+: a)
30 volatile int zero = 0;
31 a += zero;
32 if (omp_get_cancellation ())
33 abort ();
36 if (a != 64)
37 abort ();
38 #pragma omp task
40 if (omp_get_cancellation ())
41 abort ();
44 a = 0;
45 #pragma omp parallel
46 #pragma omp taskgroup
48 int p;
49 #pragma omp for reduction (task, +: a)
50 for (i = 0; i < 64; ++i)
52 a++;
53 t = 1;
54 #pragma omp task in_reduction (+: a)
56 volatile int zero = 0;
57 a += zero;
58 #pragma omp cancel taskgroup
59 if (omp_get_cancellation ())
60 abort ();
63 if (a != 64)
64 abort ();
65 p = t;
66 #pragma omp task firstprivate (p)
68 if (p && omp_get_cancellation ())
69 abort ();
72 return 0;