]> gcc.gnu.org Git - gcc.git/blob - gcc/testsuite/c-c++-common/gomp/target-has-device-addr-1.c
Merge branch 'master' into devel/modula-2.
[gcc.git] / gcc / testsuite / c-c++-common / gomp / target-has-device-addr-1.c
1 /* { dg-do compile } */
2
3 void
4 foo ()
5 {
6 int * x;
7 #pragma omp target is_device_ptr(x) has_device_addr(x) /*{ dg-error "'x' appears more than once in data clauses" } */
8 ;
9 #pragma omp target has_device_addr(x) is_device_ptr(x) /* { dg-error "'x' appears more than once in data clauses" } */
10 ;
11
12 int y = 42;
13 #pragma omp target has_device_addr(y) has_device_addr(y) /* { dg-error "'y' appears more than once in data clauses" } */
14 ;
15
16 #pragma omp target private(y) has_device_addr(y) /*{ dg-error "'y' appears more than once in data clauses" } */
17 ;
18 #pragma omp target has_device_addr(y) private(y) /*{ dg-error "'y' appears more than once in data clauses" } */
19 ;
20 #pragma omp target firstprivate(y) has_device_addr(y) /*{ dg-error "'y' appears more than once in data clauses" } */
21 ;
22
23 #pragma omp target has_device_addr(y) map(y) /* { dg-error "'y' appears both in data and map clauses" } */
24 ;
25 #pragma omp target map(y) has_device_addr(y) /* { dg-error "'y' appears both in data and map clauses" } */
26 ;
27
28 int z[3] = { 2, 5, 7 };
29 #pragma omp target data map(z[:3]) use_device_addr(z)
30 #pragma omp target has_device_addr(z[1:])
31 ;
32
33 #pragma omp target data map(z[:3]) use_device_addr(z)
34 #pragma omp target has_device_addr(z[1])
35 ;
36
37 #pragma omp target data map(z[:3]) use_device_addr(z)
38 #pragma omp target has_device_addr(z[1:2])
39 ;
40
41 #pragma omp target data map(z[:3]) use_device_addr(z)
42 #pragma omp target has_device_addr(z[:2])
43 ;
44
45 int w[3][4];
46 #pragma omp target data map(w) use_device_addr(w)
47 #pragma omp target has_device_addr(w[1][2])
48 ;
49
50 #pragma omp target data map(w) use_device_addr(w)
51 #pragma omp target has_device_addr(w[:1][2:])
52 ;
53
54 int u[0];
55 #pragma omp target data map(u) use_device_addr(u)
56 #pragma omp target has_device_addr(u)
57 ;
58
59 struct S { int m; } s;
60 s.m = 42;
61 #pragma omp target data map (s) use_device_addr (s)
62 #pragma omp target has_device_addr (s)
63 ++s.m;
64
65 }
This page took 0.041642 seconds and 5 git commands to generate.