summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gomp/pr27416.c
blob: 802402446a8e87a65fe7c199f0a1b6461e79b6e9 (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
/* PR middle-end/27416 */
/* { dg-do compile } */

void
foo (void)
{
  int i = 0, j = 0;
#pragma omp for firstprivate (j) /* { dg-error "is private in outer context" } */
  for (i = 0; i < 10; i++)
    j++;
}

int
bar (void)
{
  int i, j;
#pragma omp for lastprivate (j)	/* { dg-error "is private in outer context" } */
  for (i = 0; i < 10; i++)
    j = i;
  return j;
}

int
baz (void)
{
  int i, j = 0;
#pragma omp for reduction (+:j)	/* { dg-error "is private in outer context" } */
  for (i = 0; i < 10; i++)
    j++;
  return j;
}