summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/intent_out_5.f90
blob: 6a9c6f4bd39a17f61b1f92b9b9061bb88ac478c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
! { dg-do run }
!
! PR fortran/41479
!
! Contributed by Juergen Reuter.
!
program main
 type :: container_t
    integer :: n = 42
    ! if the following line is omitted, the problem disappears
    integer, dimension(:), allocatable :: a
 end type container_t

 type(container_t) :: container

 if (container%n /= 42) call abort()
 if (allocated(container%a)) call abort()
 container%n = 1
 allocate(container%a(50))
 call init (container)
 if (container%n /= 42) call abort()
 if (allocated(container%a)) call abort()
contains
 subroutine init (container)
   type(container_t), intent(out) :: container
 end subroutine init
end program main