aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/gomp/reduction-task-2.c
blob: 225abed1bc60cbfa61df061fc14e5d5aa40d6e35 (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
int v;
extern void foo (int);

void
bar (void)
{
  int i;
  #pragma omp for reduction (task, +: v) nowait	/* { dg-error "'task' reduction modifier on a construct with a 'nowait' clause" } */
  for (i = 0; i < 64; i++)
    foo (i);
  #pragma omp sections nowait reduction (task, +: v)	/* { dg-error "'task' reduction modifier on a construct with a 'nowait' clause" } */
  {
    foo (-2);
    #pragma omp section
    foo (-3);
  }
  #pragma omp scope reduction (task, +: v) nowait	/* { dg-error "'task' reduction modifier on a construct with a 'nowait' clause" } */
  foo (-4);
  #pragma omp simd reduction (task, +: v)	/* { dg-error "invalid 'task' reduction modifier on construct other than 'parallel', 'for', 'sections' or 'scope'" } */
  for (i = 0; i < 64; i++)
    v++;
  #pragma omp for simd reduction (task, +: v)	/* { dg-error "invalid 'task' reduction modifier on construct combined with 'simd'" } */
  for (i = 0; i < 64; i++)
    v++;
  #pragma omp parallel for simd reduction (task, +: v)	/* { dg-error "invalid 'task' reduction modifier on construct combined with 'simd'" } */
  for (i = 0; i < 64; i++)
    v++;
  #pragma omp teams distribute parallel for simd reduction (task, +: v)	/* { dg-error "invalid 'task' reduction modifier on construct combined with 'simd'" } */
  for (i = 0; i < 64; i++)
    v++;
  #pragma omp taskloop reduction (task, +: v)	/* { dg-error "invalid 'task' reduction modifier on construct other than 'parallel', 'for', 'sections' or 'scope'" } */
  for (i = 0; i < 64; i++)
    foo (i);
  #pragma omp taskloop simd reduction (task, +: v)	/* { dg-error "invalid 'task' reduction modifier on construct combined with 'simd'" } */
  for (i = 0; i < 64; i++)
    v++;
  #pragma omp teams reduction (task, +: v)	/* { dg-error "invalid 'task' reduction modifier on construct other than 'parallel', 'for', 'sections' or 'scope'" } */
  foo (i);
  #pragma omp teams distribute reduction (task, +: v)	/* { dg-error "invalid 'task' reduction modifier on construct not combined with 'parallel', 'for' or 'sections'" } */
  for (i = 0; i < 64; i++)
    foo (i);
}