view gcc/testsuite/gfortran.dg/select_type_14.f03 @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 84e7813d76e9
children
line wrap: on
line source

! { 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) STOP 1
end select
end