Debian Codegraph @

gcc/testsuite/gfortran.dg/asan/pr110415-2.f90

raw
1 ! { dg-do run }
2 !
3 ! Contributed by Brad Richardson <[email protected]>
4 !
5 implicit none
6 type, abstract :: p
7 integer :: a = 4
8 end type p
9
10 type, extends(p) :: c
11 integer :: b = 7
12 character(len=:), allocatable :: str, str2(:)
13 end type c
14
15 type, extends(p) :: d
16 integer :: ef = 7
17 end type d
18
19 class(p), allocatable :: a
20
21 a = func()
22
23 a = func2()
24
25 a = func()
26
27 deallocate(a)
28
29 contains
30 function func2() result(a)
31 class(p), allocatable :: a
32 a = d()
33 end function func2
34
35 function func() result(a)
36 class(p), allocatable :: a
37
38 a = c()
39 select type(a)
40 type is (c)
41 a%str = 'abcd'
42 a%str2 = ['abcd','efgh']
43 end select
44 end function func
45 end program