Debian Codegraph @

gcc/testsuite/g++.dg/goacc/data-clause-2.C

raw
1 /* Test data clause diagnostics. */
2
3 /* See also corresponding OpenACC C/C++ variant: '../../c-c++-common/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 template <int N>
10 void
11 foo (int *p, int (*q)[10], int r[10], int s[10][10])
12 {
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 ;
50 }
51
52 static void
53 instantiate ()
54 {
55 &foo<0>;
56 }