| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! Test for polymorphic coarrays |
| 4 |
! |
| 5 |
type t |
| 6 |
end type t |
| 7 |
class(t), allocatable :: A[:,:] |
| 8 |
allocate (A[1:4,-5:*]) |
| 9 |
if (any (lcobound(A) /= [1, -5])) STOP 1 |
| 10 |
if (num_images() == 1) then |
| 11 |
if (any (ucobound(A) /= [4, -5])) STOP 2 |
| 12 |
else |
| 13 |
if (ucobound(A,dim=1) /= 4) STOP 3 |
| 14 |
end if |
| 15 |
|
| 16 |
call s(A) |
| 17 |
call s2(A) |
| 18 |
call sa(A) |
| 19 |
contains |
| 20 |
subroutine s(x) |
| 21 |
class(t) :: x[4,2:*] |
| 22 |
if (any (lcobound(x) /= [1, 2])) STOP 4 |
| 23 |
if (num_images() == 1) then |
| 24 |
if (any (ucobound(x) /= [4, 2])) STOP 5 |
| 25 |
else |
| 26 |
if (ucobound(x,dim=1) /= 4) STOP 6 |
| 27 |
end if |
| 28 |
end subroutine s |
| 29 |
subroutine s2(x) |
| 30 |
! Check that different cobounds are set correctly. |
| 31 |
class(t) :: x[2:5,7:*] |
| 32 |
if (any (lcobound(x) /= [2, 7])) STOP 7 |
| 33 |
if (num_images() == 1) then |
| 34 |
if (any (ucobound(x) /= [5, 7])) STOP 8 |
| 35 |
else |
| 36 |
if (ucobound(x,dim=1) /= 5) STOP 9 |
| 37 |
end if |
| 38 |
end subroutine s2 |
| 39 |
subroutine sa(x) |
| 40 |
class(t), allocatable :: x[:,:] |
| 41 |
if (any (lcobound(x) /= [1, -5])) STOP 10 |
| 42 |
if (num_images() == 1) then |
| 43 |
if (any (ucobound(x) /= [4, -5])) STOP 11 |
| 44 |
else |
| 45 |
if (ucobound(x,dim=1) /= 4) STOP 12 |
| 46 |
end if |
| 47 |
end subroutine sa |
| 48 |
end |
| 49 |
|