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