1! { dg-do run }
2!
3! PR fortran/40850
4! The code freeing allocatable components used to be put after the code
5! freeing the containing entity.
6!
7! Original test case by Marco Restelli <mrestelli@gmail.com>
8! Reduced by Daniel Franke <franke.daniel@gmail.com>
9!        and Janus Weil <janus@gcc.gnu.org>
10
11
12  type t
13    integer, allocatable :: d(:)
14  end type
15  type(t), allocatable :: a(:)
16
17  ! Big enough to make it fail
18  allocate(a(2 * 1024))
19  call sub( (/ a /) )
20
21contains
22
23  subroutine sub(b)
24    type(t) :: b(:)
25  end subroutine
26
27end
28
29