aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/select_type_14.f03
blob: 2d37bbc7f8bd6edde46da8cd3b4c02b232964a5c (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
! { dg-do run }

! PR fortran/44047
! Double free happened, check that it works now.

! Contributed by Janus Weil, janus@gcc.gnu.org.

implicit none
type t0
 integer :: j = 42
end type t0
type t
 integer :: i
 class(t0), allocatable :: foo
end type t
type(t) :: m
allocate(t0 :: m%foo)
m%i = 5
select type(bar => m%foo)
type is(t0)
 print *, bar
 if (bar%j /= 42) call abort ()
end select
end