Debian Codegraph @

gcc/testsuite/gfortran.dg/alloc_comp_class_3.f03

raw
1 ! { dg-do run }
2 ! { dg-options "-Wreturn-type" }
3 !
4 ! Check that pr58586 is fixed now.
5 ! Based on a contribution by Vladimir Fuka
6 ! Contibuted by Andre Vehreschild
7
8 program test_pr58586
9 implicit none
10
11 type :: a
12 end type
13
14 type :: c
15 type(a), allocatable :: a
16 end type
17
18 type :: b
19 integer, allocatable :: a
20 end type
21
22 type :: t
23 integer, allocatable :: comp
24 end type
25 type :: u
26 type(t), allocatable :: comp
27 end type
28
29
30 ! These two are merely to check, if compilation works
31 call add(b())
32 call add(b(null()))
33
34 ! This needs to execute, to see whether the segfault at runtime is resolved
35 call add_c(c_init())
36
37 call sub(u())
38 contains
39
40 subroutine add (d)
41 type(b), value :: d
42 end subroutine
43
44 subroutine add_c (d)
45 type(c), value :: d
46 end subroutine
47
48 type(c) function c_init()
49 end function
50
51 subroutine sub(d)
52 type(u), value :: d
53 end subroutine
54 end program test_pr58586