Daily bump.
[official-gcc.git] / libgomp / testsuite / libgomp.c / depend-4.c
bloba4395ea6fc0ce573583eb2f312b0758ec1d0c414
1 #include <stdlib.h>
2 #include <unistd.h>
4 int
5 main ()
7 #pragma omp parallel
8 #pragma omp single
10 int x = 1, y = 2, z = 3;
11 #pragma omp taskgroup
13 #pragma omp task shared (x, y, z) depend(inout: x, y) \
14 depend (in: z) if (x > 10)
16 if (x != 1 || y != 2 || z != 3)
17 abort ();
18 x = 4;
19 y = 5;
21 /* The above task has depend clauses, but no dependencies
22 on earlier tasks, and is if (0), so must be scheduled
23 immediately. */
24 if (x != 4 || y != 5)
25 abort ();
27 #pragma omp taskgroup
29 #pragma omp task shared (x, y) depend(in: x, y)
31 usleep (10000);
32 if (x != 4 || y != 5 || z != 3)
33 abort ();
35 #pragma omp task shared (x, y) depend(in: x, y)
37 usleep (10000);
38 if (x != 4 || y != 5 || z != 3)
39 abort ();
41 #pragma omp task shared (x, y, z) depend(inout: x, y) \
42 depend (in: z) if (x > 10)
44 if (x != 4 || y != 5 || z != 3)
45 abort ();
46 x = 6;
47 y = 7;
49 /* The above task has depend clauses, and may have dependencies
50 on earlier tasks, while it is if (0), it can be deferred. */
52 if (x != 6 || y != 7)
53 abort ();
55 return 0;