aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c-c++-common/metadirective-3.c
blob: b6879c924408bd645574dcb8cc223e361d44508f (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
/* { dg-do run } */

#define N 100

int
f (int a[], int flag)
{
  int i;
  int res = 0;

  #pragma omp metadirective \
	when (user={condition(!flag)}: \
		target teams distribute parallel for \
		  map(from: a[0:N]) private(res)) \
	default (parallel for)
  for (i = 0; i < N; i++)
    {
      a[i] = i;
      res = 1;
    }

  return res;
}

int
main (void)
{
  int a[N];

  if (f (a, 0))
    return 1;
  if (!f (a, 1))
    return 1;

  return 0;
}