summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/derived_init_6.f90
blob: 9641a50f5836e86af0dc8c839579eec9d564505b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
! { dg-do compile }
!
! Test the fix for PR69654 in which the derived type 'ty_foo2' was
! not completely built in time for initialization thereby causing an ICE.
!
! Contributed by Hossein Talebi  <talebi.hossein@gmail.com>
!
 Module foo_pointers_class
   implicit none
    type :: ty_foo_pointers
      integer :: scale=0
      integer,pointer :: universe_ulogfile => NULL()
      class(*),pointer :: foo => NULL()
    end type ty_foo_pointers

   type :: ty_part_ptrs
      character(len=80),pointer :: part_name => NULL()
      class(*),pointer     :: part_fem => NULL()
   end type

   type :: ty_class_basis
      integer :: id=0
    end type ty_class_basis

   type :: ty_store_sclass
      class(ty_class_basis),allocatable :: OBJ
   end type ty_store_sclass
End Module foo_pointers_class

Module foo_class
   use foo_pointers_class
   implicit none
   type,extends(ty_class_basis) :: ty_foo2
      character(200)                     :: title
      logical                            :: isInit=.false.
      type(ty_foo_pointers)              :: foo
   end type ty_foo2
ENd Module foo_class


Module foo_scripts_mod
  implicit none
contains

subroutine  foo_script1
   use foo_class, only: ty_foo2
   implicit none
   type(ty_foo2) :: foo2
   integer i

   Call foo_init2(foo2)
end subroutine  foo_script1

subroutine foo_init2(self)
   use foo_class, only: ty_foo2
   type(ty_foo2),target :: self
   self%isInit=.true.
end subroutine foo_init2

End Module foo_scripts_mod