| 1 |
!{ dg-do run } |
| 2 |
|
| 3 |
! Check that PR77871 is fixed. |
| 4 |
|
| 5 |
! Contributed by Gerhard Steinmetz <[email protected]> |
| 6 |
|
| 7 |
program pr77871 |
| 8 |
type t |
| 9 |
integer :: i |
| 10 |
end type |
| 11 |
|
| 12 |
type(t) :: p[*] |
| 13 |
type(t), allocatable :: p2(:)[:] |
| 14 |
|
| 15 |
p%i = 42 |
| 16 |
allocate (p2(5)[*]) |
| 17 |
p2(:)%i = (/(i, i=0, 4)/) |
| 18 |
call s(p, 1) |
| 19 |
call s2(p2, 1) |
| 20 |
contains |
| 21 |
subroutine s(x, n) |
| 22 |
class(t) :: x[*] |
| 23 |
integer :: n |
| 24 |
if (x[n]%i /= 42) stop 1 |
| 25 |
end |
| 26 |
|
| 27 |
subroutine s2(x, n) |
| 28 |
class(t) :: x(:)[*] |
| 29 |
integer :: n |
| 30 |
if (any(x(:)[n]%i /= (/(i, i= 0, 4)/) )) stop 2 |
| 31 |
end |
| 32 |
end |
| 33 |
|