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