1! { dg-do run }
2
3! PR fortran/44047
4! Double free happened, check that it works now.
5
6! Contributed by Janus Weil, janus@gcc.gnu.org.
7
8implicit none
9type t0
10 integer :: j = 42
11end type t0
12type t
13 integer :: i
14 class(t0), allocatable :: foo
15end type t
16type(t) :: m
17allocate(t0 :: m%foo)
18m%i = 5
19select type(bar => m%foo)
20type is(t0)
21 print *, bar
22 if (bar%j /= 42) STOP 1
23end select
24end
25