1 /* Test data clause diagnostics.  */
2 
3 /* See also corresponding OpenACC C++ variant: '../../g++.dg/goacc/data-clause-2.C'.  */
4 
5 /* See also corresponding OpenACC 'cache' directive variant: 'cache-3-2.c'.  */
6 
7 /* See also corresponding OpenMP variant: '../gomp/map-2.c'.  */
8 
9 void
foo(int * p,int (* q)[10],int r[10],int s[10][10])10 foo (int *p, int (*q)[10], int r[10], int s[10][10])
11 {
12   int a[10], b[10][10];
13   #pragma acc parallel copy (p[-1:2])
14   ;
15   #pragma acc parallel copy (q[-1:2][0:10])
16   ;
17   #pragma acc parallel copy (q[-1:2][-2:10]) /* { dg-error "negative low bound in array section in" } */
18   ;
19   #pragma acc parallel copy (r[-1:2])
20   ;
21   #pragma acc parallel copy (s[-1:2][:])
22   ;
23   #pragma acc parallel copy (s[-1:2][-2:10]) /* { dg-error "negative low bound in array section in" } */
24   ;
25   #pragma acc parallel copy (a[-1:2])	 /* { dg-error "negative low bound in array section in" } */
26   ;
27   #pragma acc parallel copy (b[-1:2][0:])	 /* { dg-error "negative low bound in array section in" } */
28   ;
29   #pragma acc parallel copy (b[1:2][-2:10]) /* { dg-error "negative low bound in array section in" } */
30   ;
31   #pragma acc parallel copy (p[2:-3])	 /* { dg-error "negative length in array section in" } */
32   ;
33   #pragma acc parallel copy (q[2:-3][:])	 /* { dg-error "negative length in array section in" } */
34   ;
35   #pragma acc parallel copy (q[2:3][0:-1])	 /* { dg-error "negative length in array section in" } */
36   ;
37   #pragma acc parallel copy (r[2:-5])	 /* { dg-error "negative length in array section in" } */
38   ;
39   #pragma acc parallel copy (s[2:-5][:])	 /* { dg-error "negative length in array section in" } */
40   ;
41   #pragma acc parallel copy (s[2:5][0:-4])	 /* { dg-error "negative length in array section in" } */
42   ;
43   #pragma acc parallel copy (a[2:-5])	 /* { dg-error "negative length in array section in" } */
44   ;
45   #pragma acc parallel copy (b[2:-5][0:10]) /* { dg-error "negative length in array section in" } */
46   ;
47   #pragma acc parallel copy (b[2:5][0:-4]) /* { dg-error "negative length in array section in" } */
48   ;
49 }
50