2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / select_type_14.f03
blob2d37bbc7f8bd6edde46da8cd3b4c02b232964a5c
1 ! { dg-do run }
3 ! PR fortran/44047
4 ! Double free happened, check that it works now.
6 ! Contributed by Janus Weil, janus@gcc.gnu.org.
8 implicit none
9 type t0
10  integer :: j = 42
11 end type t0
12 type t
13  integer :: i
14  class(t0), allocatable :: foo
15 end type t
16 type(t) :: m
17 allocate(t0 :: m%foo)
18 m%i = 5
19 select type(bar => m%foo)
20 type is(t0)
21  print *, bar
22  if (bar%j /= 42) call abort ()
23 end select
24 end