blob: 192c6ddfeba68135b3e4a14489fe7cb55bf78ac2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
#include <stdlib.h>
__attribute__((noinline, noclone)) void
f1 (int ifval)
{
int x = 1, y = 2, z = 3;
#pragma omp parallel
#pragma omp single
{
#pragma omp task shared (x) depend(out: x)
x = 2;
#pragma omp task shared (x) depend(inout: x)
{
if (x != 2)
abort ();
x = 3;
}
#pragma omp task shared (x) depend(inout: x)
{
if (x != 3)
abort ();
x = 4;
}
#pragma omp task shared (z) depend(in: z)
if (z != 3)
abort ();
#pragma omp task shared (z) depend(in: z)
if (z != 3)
abort ();
#pragma omp task shared (z) depend(in: z)
if (z != 3)
abort ();
#pragma omp task shared (z) depend(in: z)
if (z != 3)
abort ();
#pragma omp task shared (z) depend(in: z)
if (z != 3)
abort ();
#pragma omp task shared (z) depend(in: z)
if (z != 3)
abort ();
#pragma omp task shared (y) depend(in: y)
if (y != 2)
abort ();
#pragma omp task shared (y) depend(in: y)
if (y != 2)
abort ();
#pragma omp task shared (y) depend(in: y)
if (y != 2)
abort ();
#pragma omp task shared (y) depend(in: y)
if (y != 2)
abort ();
#pragma omp task if (ifval) shared (x, y) depend(in: x) depend(inout: y)
{
if (x != 4 || y != 2)
abort ();
y = 3;
}
if (ifval == 0)
{
/* The above if (0) task should have waited till all
the tasks with x and y dependencies finish. */
if (x != 4 || y != 3)
abort ();
x = 5;
y = 4;
}
#pragma omp task shared (z) depend(inout: z)
{
if (z != 3)
abort ();
z = 4;
}
#pragma omp task shared (z) depend(inout: z)
{
if (z != 4)
abort ();
z = 5;
}
#pragma omp taskwait
if (x != (ifval ? 4 : 5) || y != (ifval ? 3 : 4) || z != 5)
abort ();
#pragma omp task if (ifval) shared (x, y) depend(in: x) depend(inout: y)
{
if (x != (ifval ? 4 : 5) || y != (ifval ? 3 : 4))
abort ();
}
}
}
int
main ()
{
f1 (0);
f1 (1);
return 0;
}
|