aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c-c++-common/taskwait-depend-1.c
blob: 094b4b3586a336c6cc64f590c8bb8ffef96a53e1 (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
#ifdef __cplusplus
extern "C"
#endif
void abort (void);

int
main ()
{
  int a, b, c, d;
  #pragma omp parallel num_threads (4)
  #pragma omp single
  {
    #pragma omp task depend(out : a)
    a = 6;
    #pragma omp task depend(out : b)
    b = 7;
    #pragma omp task depend(out : c)
    c = 8;
    #pragma omp taskwait depend(in : a, c)
    d = a + c;
    #pragma omp task depend(out : a)
    a = 9;
    #pragma omp task depend(out : c)
    c = 10;
  }
  if (a != 9 || b != 7 || c != 10 || d != 6 + 8)
    abort ();
  return 0;
}