Debian Codegraph @

gcc/testsuite/gfortran.dg/asan/pr110415-3.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(),d()]
33 end function func2
34
35 function func() result(a)
36 class(p), allocatable :: a(:)
37
38 a = [c(),c(),c()]
39 select type(a)
40 type is (c)
41 a(1)%str = 'abcd'
42 a(2)%str = 'abc'
43 a(3)%str = 'abcd4'
44 a(1)%str2 = ['abcd','efgh']
45 a(2)%str2 = ['bcd','fgh']
46 a(3)%str2 = ['abcd6','efgh7']
47 end select
48 end function func
49 end program