| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! PR fortran/41479 |
| 4 |
! |
| 5 |
! Contributed by Juergen Reuter. |
| 6 |
! |
| 7 |
program main |
| 8 |
type :: container_t |
| 9 |
integer :: n = 42 |
| 10 |
! if the following line is omitted, the problem disappears |
| 11 |
integer, dimension(:), allocatable :: a |
| 12 |
end type container_t |
| 13 |
|
| 14 |
type(container_t) :: container |
| 15 |
|
| 16 |
if (container%n /= 42) STOP 1 |
| 17 |
if (allocated(container%a)) STOP 2 |
| 18 |
container%n = 1 |
| 19 |
allocate(container%a(50)) |
| 20 |
call init (container) |
| 21 |
if (container%n /= 42) STOP 3 |
| 22 |
if (allocated(container%a)) STOP 4 |
| 23 |
contains |
| 24 |
subroutine init (container) |
| 25 |
type(container_t), intent(out) :: container |
| 26 |
end subroutine init |
| 27 |
end program main |