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