Hi! The 4.0 spec required that low-bound in array section must not be negative. The 4.5 spec removes that restriction, for arrays it is obvious that it is invalid anyway (pointer arithmetics disallows that), and for pointers it is meaningful.
After looking what I've implemented, it seems I've applied common sense rather than strictly reading the standard. And that is the behavior we want for OpenMP 4.5, so I've just added new testcases to cover the various cases. 2015-10-09 Jakub Jelinek <ja...@redhat.com> * c-c++-common/gomp/depend-4.c: New test. * c-c++-common/gomp/map-2.c: New test. --- gcc/testsuite/c-c++-common/gomp/depend-4.c.jj 2015-10-09 11:04:54.676862229 +0200 +++ gcc/testsuite/c-c++-common/gomp/depend-4.c 2015-10-09 11:04:46.359979185 +0200 @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +void +foo (int *p, int (*q)[10], int r[10], int s[10][10]) +{ + int a[10], b[10][10]; + #pragma omp task depend (inout: p[-1:2]) + ; + #pragma omp task depend (inout: q[-1:2][2:4]) + ; + #pragma omp task depend (inout: q[-1:2][-2:4]) /* { dg-error "negative low bound in array section in" } */ + ; + #pragma omp task depend (inout: r[-1:2]) + ; + #pragma omp task depend (inout: s[-1:2][2:4]) + ; + #pragma omp task depend (inout: s[-1:2][-2:4]) /* { dg-error "negative low bound in array section in" } */ + ; + #pragma omp task depend (inout: a[-1:2]) /* { dg-error "negative low bound in array section in" } */ + ; + #pragma omp task depend (inout: b[-1:2][2:4]) /* { dg-error "negative low bound in array section in" } */ + ; + #pragma omp task depend (inout: b[1:2][-2:4]) /* { dg-error "negative low bound in array section in" } */ + ; +} --- gcc/testsuite/c-c++-common/gomp/map-2.c.jj 2015-10-09 11:05:40.752214292 +0200 +++ gcc/testsuite/c-c++-common/gomp/map-2.c 2015-10-09 11:07:19.558824818 +0200 @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +void +foo (int *p, int (*q)[10], int r[10], int s[10][10]) +{ + int a[10], b[10][10]; + #pragma omp target map (tofrom: p[-1:2]) + ; + #pragma omp target map (tofrom: q[-1:2][0:10]) + ; + #pragma omp target map (tofrom: q[-1:2][-2:10]) /* { dg-error "negative low bound in array section in" } */ + ; + #pragma omp target map (tofrom: r[-1:2]) + ; + #pragma omp target map (tofrom: s[-1:2][:]) + ; + #pragma omp target map (tofrom: s[-1:2][-2:10]) /* { dg-error "negative low bound in array section in" } */ + ; + #pragma omp target map (tofrom: a[-1:2]) /* { dg-error "negative low bound in array section in" } */ + ; + #pragma omp target map (tofrom: b[-1:2][0:]) /* { dg-error "negative low bound in array section in" } */ + ; + #pragma omp target map (tofrom: b[1:2][-2:10]) /* { dg-error "negative low bound in array section in" } */ + ; +} Jakub