| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! Test the fix for PR100040 |
| 4 |
! |
| 5 |
|
| 6 |
program foo_p |
| 7 |
implicit none |
| 8 |
|
| 9 |
integer, parameter :: n = 11 |
| 10 |
|
| 11 |
type :: foo_t |
| 12 |
integer :: i |
| 13 |
end type foo_t |
| 14 |
|
| 15 |
type(foo_t), parameter :: a = foo_t(n) |
| 16 |
|
| 17 |
class(foo_t), allocatable :: pout |
| 18 |
|
| 19 |
call foo_s(pout) |
| 20 |
if(.not.allocated(pout)) stop 1 |
| 21 |
if(pout%i/=n) stop 2 |
| 22 |
|
| 23 |
contains |
| 24 |
|
| 25 |
subroutine foo_s(that) |
| 26 |
class(foo_t), allocatable, intent(out) :: that(..) |
| 27 |
|
| 28 |
select rank(that) |
| 29 |
rank(0) |
| 30 |
that = a |
| 31 |
rank default |
| 32 |
stop 3 |
| 33 |
end select |
| 34 |
end subroutine foo_s |
| 35 |
|
| 36 |
end program foo_p |