Debian Codegraph @

gcc/testsuite/gfortran.dg/derived_init_6.f90

raw
1 ! { dg-do compile }
2 !
3 ! Test the fix for PR69654 in which the derived type 'ty_foo2' was
4 ! not completely built in time for initialization thereby causing an ICE.
5 !
6 ! Contributed by Hossein Talebi <[email protected]>
7 !
8 Module foo_pointers_class
9 implicit none
10 type :: ty_foo_pointers
11 integer :: scale=0
12 integer,pointer :: universe_ulogfile => NULL()
13 class(*),pointer :: foo => NULL()
14 end type ty_foo_pointers
15
16 type :: ty_part_ptrs
17 character(len=80),pointer :: part_name => NULL()
18 class(*),pointer :: part_fem => NULL()
19 end type
20
21 type :: ty_class_basis
22 integer :: id=0
23 end type ty_class_basis
24
25 type :: ty_store_sclass
26 class(ty_class_basis),allocatable :: OBJ
27 end type ty_store_sclass
28 End Module foo_pointers_class
29
30 Module foo_class
31 use foo_pointers_class
32 implicit none
33 type,extends(ty_class_basis) :: ty_foo2
34 character(200) :: title
35 logical :: isInit=.false.
36 type(ty_foo_pointers) :: foo
37 end type ty_foo2
38 ENd Module foo_class
39
40
41 Module foo_scripts_mod
42 implicit none
43 contains
44
45 subroutine foo_script1
46 use foo_class, only: ty_foo2
47 implicit none
48 type(ty_foo2) :: foo2
49 integer i
50
51 Call foo_init2(foo2)
52 end subroutine foo_script1
53
54 subroutine foo_init2(self)
55 use foo_class, only: ty_foo2
56 type(ty_foo2),target :: self
57 self%isInit=.true.
58 end subroutine foo_init2
59
60 End Module foo_scripts_mod