diff options
author | Mikael Morin <mikael@gcc.gnu.org> | 2011-10-18 15:23:04 +0000 |
---|---|---|
committer | Mikael Morin <mikael@gcc.gnu.org> | 2011-10-18 15:23:04 +0000 |
commit | 1b688c0e01dfc54f3e5a77c2e76892ebb4dae43b (patch) | |
tree | ba1d08c056f170265784a94006175698481ef94e /gcc | |
parent | fef8962802d6a69b56eb31aba37b7c841a992ef6 (diff) | |
download | gcc-1b688c0e01dfc54f3e5a77c2e76892ebb4dae43b.zip gcc-1b688c0e01dfc54f3e5a77c2e76892ebb4dae43b.tar.gz gcc-1b688c0e01dfc54f3e5a77c2e76892ebb4dae43b.tar.bz2 |
re PR fortran/50420 ([Coarray] lcobound doesn't accept coarray subcomponents)
PR fortran/50420
* gfortran.dg/coarray_subobject_1.f90: New test.
* gfortran.dg/coarray/subobject_1.f90: New test.
From-SVN: r180153
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/coarray/subobject_1.f90 | 43 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/coarray_subobject_1.f90 | 31 |
3 files changed, 80 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a883aa5..d44d2c5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-10-18 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/50420 + * gfortran.dg/coarray_subobject_1.f90: New test. + * gfortran.dg/coarray/subobject_1.f90: New test. + 2011-10-18 Alexander Monakov <amonakov@ispras.ru> PR rtl-optimization/50205 diff --git a/gcc/testsuite/gfortran.dg/coarray/subobject_1.f90 b/gcc/testsuite/gfortran.dg/coarray/subobject_1.f90 new file mode 100644 index 0000000..0253686 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray/subobject_1.f90 @@ -0,0 +1,43 @@ +! { dg-do run } +! +! PR fortran/50420 +! Coarray subobjects were not accepted as valid coarrays + + integer :: i + integer, parameter :: la = 4, lb = 5, lc = 8 + integer, parameter :: init(la) = -4 + (/ (i, i=1,la) /) + + type t + integer :: i + end type t + type t2 + type(t), allocatable :: a[:] + end type t2 + type t3 + type(t), allocatable :: a(:)[:] + end type t3 + + type(t2) :: b + type(t3) :: c + + allocate(b%a[lb:*]) + b%a%i = 7 + if (b%a%i /= 7) call abort + if (any (lcobound(b%a) /= (/ lb /))) call abort + if (ucobound(b%a, dim=1) /= this_image() + lb - 1) call abort + if (any (lcobound(b%a%i) /= (/ lb /))) call abort + if (ucobound(b%a%i, dim=1) /= this_image() + lb - 1) call abort + allocate(c%a(la)[lc:*]) + c%a%i = init + if (any(c%a%i /= init)) call abort + if (any (lcobound(c%a) /= (/ lc /))) call abort + if (ucobound(c%a, dim=1) /= this_image() + lc - 1) call abort + if (any (lcobound(c%a%i) /= (/ lc /))) call abort + if (ucobound(c%a%i, dim=1) /= this_image() + lc - 1) call abort + if (c%a(2)%i /= init(2)) call abort + if (any (lcobound(c%a(2)) /= (/ lc /))) call abort + if (ucobound(c%a(2), dim=1) /= this_image() + lc - 1) call abort + if (any (lcobound(c%a(2)%i) /= (/ lc /))) call abort + if (ucobound(c%a(2)%i, dim=1) /= this_image() + lc - 1) call abort + deallocate(b%a, c%a) +end diff --git a/gcc/testsuite/gfortran.dg/coarray_subobject_1.f90 b/gcc/testsuite/gfortran.dg/coarray_subobject_1.f90 new file mode 100644 index 0000000..52c65e1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_subobject_1.f90 @@ -0,0 +1,31 @@ +! { dg-do compile } +! { dg-options "-fcoarray=single" } +! +! PR fortran/50420 +! Coarray subobjects were not accepted as valid coarrays +! They should still be rejected if one of the component reference is allocatable +! or pointer + +type t + integer :: i +end type t +type t2 + type(t), allocatable :: a + type(t), pointer :: c +end type t2 +type(t2) :: b[5:*] +allocate(b%a) +allocate(b%c) +b%a%i = 7 +b%c%i = 13 +if (b%a%i /= 7) call abort +if (any (lcobound(b%a) /= (/ 5 /))) call abort ! { dg-error "Expected coarray variable" } +if (ucobound(b%a, dim=1) /= this_image() + 4) call abort ! { dg-error "Expected coarray variable" } +if (any (lcobound(b%a%i) /= (/ 5 /))) call abort ! { dg-error "Expected coarray variable" } +if (ucobound(b%a%i, dim=1) /= this_image() + 4) call abort ! { dg-error "Expected coarray variable" } +if (b%c%i /= 13) call abort +if (any (lcobound(b%c) /= (/ 5 /))) call abort ! { dg-error "Expected coarray variable" } +if (ucobound(b%c, dim=1) /= this_image() + 4) call abort ! { dg-error "Expected coarray variable" } +if (any (lcobound(b%c%i) /= (/ 5 /))) call abort ! { dg-error "Expected coarray variable" } +if (ucobound(b%c%i, dim=1) /= this_image() + 4) call abort ! { dg-error "Expected coarray variable" } +end |