Debian Codegraph @

gcc/testsuite/c-c++-common/gomp/depobj-3.c

raw
1 /* { dg-additional-options "-fexcess-precision=fast" } */
2
3 typedef struct __attribute__((__aligned__ (sizeof (void *)))) omp_depend_t {
4 char __omp_depend_t__[2 * sizeof (void *)];
5 } omp_depend_t;
6
7 void
8 f ()
9 {
10 omp_depend_t obj2;
11 struct { omp_depend_t c; } s;
12 float a;
13 #pragma omp depobj(s.c) depend(inout: a)
14
15 #pragma omp depobj(s.c) destroy(s.c) /* OK */
16
17 #pragma omp depobj(s.c) destroy(obj2)
18 /* { dg-warning "the 'destroy' expression 'obj2' should be the same as the 'depobj' argument 's.c'" "" { target c } .-1 } */
19 /* { dg-warning "the 'destroy' expression 'obj2' should be the same as the 'depobj' argument 's.f\\(\\)::<unnamed struct>::c'" "" { target c++ } .-2 } */
20 }
21
22 void
23 g ()
24 {
25 volatile omp_depend_t obj3;
26 #pragma omp depobj(obj3) destroy(obj3)
27 }
28
29 int
30 main ()
31 {
32 float a;
33 omp_depend_t obj;
34
35 #pragma omp depobj(obj) depend(inout: a)
36
37 #pragma omp depobj(obj) destroy(obj) /* OK */
38
39 #pragma omp depobj(obj) destroy(a + 5)
40 /* { dg-error "'destroy' expression is not lvalue expression" "" { target c } .-1 } */
41 /* { dg-warning "the 'destroy' expression '\\(a \\+ \\(float\\)5\\)' should be the same as the 'depobj' argument 'obj'" "" { target c++ } .-2 } */
42
43 #pragma omp depobj(obj+5) destroy(a)
44 /* { dg-error "invalid operands to binary \\+ \\(have 'omp_depend_t' and 'int'\\)" "" { target c } .-1 } */
45 /* { dg-error "no match for 'operator\\+' in 'obj \\+ 5' \\(operand types are 'omp_depend_t' and 'int'\\)" "" { target c++ } .-2 } */
46
47 #pragma omp depobj(obj) destroy(a) /* { dg-warning "the 'destroy' expression 'a' should be the same as the 'depobj' argument 'obj'" } */
48 return 0;
49 }