aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/gomp/depobj-3.c
blob: 526c4293ed345836f46962f1eceada72f135e747 (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
43
44
45
46
47
48
49
/* { dg-additional-options "-fexcess-precision=fast" } */

typedef struct __attribute__((__aligned__ (sizeof (void *)))) omp_depend_t {
  char __omp_depend_t__[2 * sizeof (void *)];
} omp_depend_t;

void
f ()
{
  omp_depend_t obj2;
  struct { omp_depend_t c; } s;
  float a;
  #pragma omp depobj(s.c) depend(inout: a)

  #pragma omp depobj(s.c) destroy(s.c) /* OK */

  #pragma omp depobj(s.c) destroy(obj2)
/* { dg-warning "the 'destroy' expression 'obj2' should be the same as the 'depobj' argument 's.c'" "" { target c } .-1 } */
/* { dg-warning "the 'destroy' expression 'obj2' should be the same as the 'depobj' argument 's.f\\(\\)::<unnamed struct>::c'" "" { target c++ } .-2 } */
}

void
g ()
{
  volatile omp_depend_t obj3;
  #pragma omp depobj(obj3) destroy(obj3)
}

int
main ()
{
   float a;
   omp_depend_t obj;

   #pragma omp depobj(obj) depend(inout: a)

   #pragma omp depobj(obj) destroy(obj) /* OK */

   #pragma omp depobj(obj) destroy(a + 5) 
/* { dg-error "'destroy' expression is not lvalue expression" "" { target c } .-1 } */
/* { dg-warning "the 'destroy' expression '\\(a \\+ \\(float\\)5\\)' should be the same as the 'depobj' argument 'obj'" "" { target c++ } .-2 } */

   #pragma omp depobj(obj+5) destroy(a) 
/* { dg-error "invalid operands to binary \\+ \\(have 'omp_depend_t' and 'int'\\)" "" { target c } .-1 } */
/* { dg-error "no match for 'operator\\+' in 'obj \\+ 5' \\(operand types are 'omp_depend_t' and 'int'\\)" "" { target c++ } .-2 } */

   #pragma omp depobj(obj) destroy(a)  /* { dg-warning "the 'destroy' expression 'a' should be the same as the 'depobj' argument 'obj'" } */
   return 0;
}