Handle symbol visibility/locality for PIE/PIC
[official-gcc.git] / gcc / testsuite / c-c++-common / goacc / deviceptr-1.c
blob546fa82958e6ca15114d97081ef3d345ea392e95
1 /* { dg-skip-if "not yet" { c++ } } */
3 void
4 fun1 (void)
6 #pragma acc parallel deviceptr(u) /* { dg-error "'u' undeclared" } */
8 #pragma acc kernels deviceptr(u[0:4]) /* { dg-error "expected '\\\)' before '\\\[' token" } */
11 #pragma acc data deviceptr(fun1) /* { dg-error "'fun1' is not a variable" } */
13 #pragma acc parallel deviceptr(fun1[2:5])
14 /* { dg-error "'fun1' is not a variable" "not a variable" { target *-*-* } 13 } */
15 /* { dg-error "expected '\\\)' before '\\\[' token" "array" { target *-*-* } 13 } */
18 int i;
19 #pragma acc kernels deviceptr(i) /* { dg-error "'i' is not a pointer variable" } */
21 #pragma acc data deviceptr(i[0:4])
22 /* { dg-error "'i' is not a pointer variable" "not a pointer variable" { target *-*-* } 21 } */
23 /* { dg-error "expected '\\\)' before '\\\[' token" "array" { target *-*-* } 21 } */
26 float fa[10];
27 #pragma acc parallel deviceptr(fa) /* { dg-error "'fa' is not a pointer variable" } */
29 #pragma acc kernels deviceptr(fa[1:5])
30 /* { dg-error "'fa' is not a pointer variable" "not a pointer variable" { target *-*-* } 29 } */
31 /* { dg-error "expected '\\\)' before '\\\[' token" "array" { target *-*-* } 29 } */
34 float *fp;
35 #pragma acc data deviceptr(fp)
37 #pragma acc parallel deviceptr(fp[0:4]) /* { dg-error "expected '\\\)' before '\\\[' token" } */
41 void
42 fun2 (void)
44 int i;
45 float *fp;
46 #pragma acc kernels deviceptr(fp,u,fun2,i,fp)
47 /* { dg-error "'u' undeclared" "u undeclared" { target *-*-* } 46 } */
48 /* { dg-error "'fun2' is not a variable" "fun2 not a variable" { target *-*-* } 46 } */
49 /* { dg-error "'i' is not a pointer variable" "i not a pointer variable" { target *-*-* } 46 } */
50 /* { dg-error "'fp' appears more than once in map clauses" "fp more than once" { target *-*-* } 46 } */
54 void
55 fun3 (void)
57 float *fp;
58 #pragma acc data deviceptr(fp,fp) /* { dg-error "'fp' appears more than once in map clauses" } */
60 #pragma acc parallel deviceptr(fp) deviceptr(fp) /* { dg-error "'fp' appears more than once in map clauses" } */
62 #pragma acc kernels copy(fp) deviceptr(fp) /* { dg-error "'fp' appears more than once in map clauses" } */
66 extern struct s s1;
67 extern struct s s2[1]; /* { dg-error "array type has incomplete element type" "" { target c } } */
69 void
70 fun4 (void)
72 struct s *s1_p = &s1;
73 struct s *s2_p = &s2;
75 #pragma acc parallel deviceptr(s1) /* { dg-error "'s1' is not a pointer variable" } */
78 #pragma acc parallel deviceptr(s2)
81 #pragma acc parallel deviceptr(s1_p)
82 s1_p = 0;
84 #pragma acc parallel deviceptr(s2_p)
85 s2_p = 0;