Message ID | 20200104022514.115942-1-julian@codesourcery.com |
---|---|
State | New |
Headers | show |
Series | [1/3] Add OpenACC test for sub-references being pointer or allocatable variables | expand |
Hi Julian, looks good to me – thanks! Tobias On 1/4/20 3:25 AM, Julian Brown wrote: > Hi, > > This test (by Tobias Burnus, mildly edited) adds a test to check whether > the final component of a derived-type access has pointer or allocatable > type for manual deep copy attach/detach operations. This is just checking > existing behaviour. > > This arose from discussion of the manual deep copy patch here: > > https://gcc.gnu.org/ml/gcc-patches/2019-12/msg01439.html > > OK? > > Thanks, > > Julian > > ChangeLog > > 2020-01-04 Tobias Burnus <tobias@codesourcery.com> > > gcc/testsuite/ > * gfortran.dg/goacc/strided-alloc-ptr.f90: New test. > --- > .../gfortran.dg/goacc/strided-alloc-ptr.f90 | 34 +++++++++++++++++++ > 1 file changed, 34 insertions(+) > create mode 100644 gcc/testsuite/gfortran.dg/goacc/strided-alloc-ptr.f90 > > diff --git a/gcc/testsuite/gfortran.dg/goacc/strided-alloc-ptr.f90 b/gcc/testsuite/gfortran.dg/goacc/strided-alloc-ptr.f90 > new file mode 100644 > index 00000000000..755fd1c164b > --- /dev/null > +++ b/gcc/testsuite/gfortran.dg/goacc/strided-alloc-ptr.f90 > @@ -0,0 +1,34 @@ > +implicit none > +type t > + integer, allocatable :: i, j(:) > + integer, pointer :: k, ll(:) > +end type t > +type(t) :: x(2) > + > +!$acc enter data copyin(x) > + > +!$acc enter data copyin(x(:)%i) > +! { dg-error "Component to the right of a part reference with nonzero rank must not have the ALLOCATABLE attribute" "" { target "*-*-*" } 10 } > +! { dg-error ".x. in MAP clause at .1. is not a proper array section" "" { target "*-*-*" } 10 } > + > +!$acc enter data copyin(x(:)%j(3)) > +! { dg-error "Component to the right of a part reference with nonzero rank must not have the ALLOCATABLE attribute" "" { target "*-*-*" } 14 } > +! { dg-error ".x. in MAP clause at .1. is not a proper array section" "" { target "*-*-*" } 14 } > + > +!$acc enter data copyin(x(:)%j) > +! { dg-error "Component to the right of a part reference with nonzero rank must not have the ALLOCATABLE attribute" "" { target "*-*-*" } 18 } > +! { dg-error ".x. in MAP clause at .1. is not a proper array section" "" { target "*-*-*" } 18 } > + > + > +!$acc enter data copyin(x(:)%k) > +! { dg-error "Component to the right of a part reference with nonzero rank must not have the POINTER attribute" "" { target "*-*-*" } 23 } > +! { dg-error ".x. in MAP clause at .1. is not a proper array section" "" { target "*-*-*" } 23 } > + > +!$acc enter data copyin(x(:)%ll(3)) > +! { dg-error "Component to the right of a part reference with nonzero rank must not have the POINTER attribute" "" { target "*-*-*" } 27 } > +! { dg-error ".x. in MAP clause at .1. is not a proper array section" "" { target "*-*-*" } 27 } > + > +!$acc enter data copyin(x(:)%ll) > +! { dg-error "Component to the right of a part reference with nonzero rank must not have the POINTER attribute" "" { target "*-*-*" } 31 } > +! { dg-error ".x. in MAP clause at .1. is not a proper array section" "" { target "*-*-*" } 31 } > +end
diff --git a/gcc/testsuite/gfortran.dg/goacc/strided-alloc-ptr.f90 b/gcc/testsuite/gfortran.dg/goacc/strided-alloc-ptr.f90 new file mode 100644 index 00000000000..755fd1c164b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/strided-alloc-ptr.f90 @@ -0,0 +1,34 @@ +implicit none +type t + integer, allocatable :: i, j(:) + integer, pointer :: k, ll(:) +end type t +type(t) :: x(2) + +!$acc enter data copyin(x) + +!$acc enter data copyin(x(:)%i) +! { dg-error "Component to the right of a part reference with nonzero rank must not have the ALLOCATABLE attribute" "" { target "*-*-*" } 10 } +! { dg-error ".x. in MAP clause at .1. is not a proper array section" "" { target "*-*-*" } 10 } + +!$acc enter data copyin(x(:)%j(3)) +! { dg-error "Component to the right of a part reference with nonzero rank must not have the ALLOCATABLE attribute" "" { target "*-*-*" } 14 } +! { dg-error ".x. in MAP clause at .1. is not a proper array section" "" { target "*-*-*" } 14 } + +!$acc enter data copyin(x(:)%j) +! { dg-error "Component to the right of a part reference with nonzero rank must not have the ALLOCATABLE attribute" "" { target "*-*-*" } 18 } +! { dg-error ".x. in MAP clause at .1. is not a proper array section" "" { target "*-*-*" } 18 } + + +!$acc enter data copyin(x(:)%k) +! { dg-error "Component to the right of a part reference with nonzero rank must not have the POINTER attribute" "" { target "*-*-*" } 23 } +! { dg-error ".x. in MAP clause at .1. is not a proper array section" "" { target "*-*-*" } 23 } + +!$acc enter data copyin(x(:)%ll(3)) +! { dg-error "Component to the right of a part reference with nonzero rank must not have the POINTER attribute" "" { target "*-*-*" } 27 } +! { dg-error ".x. in MAP clause at .1. is not a proper array section" "" { target "*-*-*" } 27 } + +!$acc enter data copyin(x(:)%ll) +! { dg-error "Component to the right of a part reference with nonzero rank must not have the POINTER attribute" "" { target "*-*-*" } 31 } +! { dg-error ".x. in MAP clause at .1. is not a proper array section" "" { target "*-*-*" } 31 } +end