Debian Codegraph @

gcc/testsuite/gfortran.dg/pr71047.f08

raw
1 ! { dg-do compile }
2 ! { dg-options "-fdump-tree-original" }
3 !
4 ! Fortran/PR71047
5 !
6
7 module m
8 implicit none
9
10 type, abstract :: c_abstr
11 integer :: i = 0
12 end type c_abstr
13
14 type, extends(c_abstr) :: t_a
15 class(c_abstr), allocatable :: f
16 end type t_a
17
18 type, extends(c_abstr) :: t_b
19 end type t_b
20
21 contains
22
23 subroutine set(y,x)
24 class(c_abstr), intent(in) :: x
25 type(t_a), intent(out) :: y
26 allocate( y%f , source=x )
27 end subroutine set
28
29 end module m
30
31
32 program p
33 use m
34 implicit none
35
36 type(t_a) :: res
37 type(t_b) :: var
38
39 call set( res , var )
40 write(*,*) res%i
41
42 end program p
43
44 !
45 ! Check to ensure the vtable is actually initialized.
46 !
47 ! { dg-final { scan-tree-dump "t_a\\.\\d+\\.f\\._vptr =" "original" } }
48 !