aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gomp/reduction-2.c
blob: f8ac8b6bbfec430dd8b484f40e7baa4cd2d37255 (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
/* { dg-do compile } */
/* { dg-options "-fopenmp" } */

struct S {};
void foo (void *, void *);
void bar (void *, void *);
void baz (void *);
#pragma omp declare reduction(+:struct S:foo (&omp_out, &omp_in))initializer(bar(&omp_priv, &omp_orig))

void
test1 (void)
{
  struct S s;
  int i;
  #pragma omp parallel reduction(+:s)
    baz (&s);
  #pragma omp parallel reduction(task, +:s)	/* { dg-error "zero sized type 'struct S' in 'reduction' clause" } */
    baz (&s);
  #pragma omp taskloop reduction(+:s)		/* { dg-error "zero sized type 'struct S' in 'reduction' clause" } */
  for (i = 0; i < 1; i++)
    baz (&s);
  #pragma omp taskloop simd reduction(+:s)	/* { dg-error "zero sized type 'struct S' in 'reduction' clause" } */
  for (i = 0; i < 1; i++)
    baz (&s);
  #pragma omp taskgroup task_reduction(+:s)	/* { dg-error "zero sized type 'struct S' in 'task_reduction' clause" } */
  {
    #pragma omp task in_reduction(+:s)		/* { dg-error "zero sized type 'struct S' in 'in_reduction' clause" } */
    baz (&s);
  }
}