summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/derived_pointer_recursion_2.f90
blob: f6bda4d0531f146fb7faa591e6d66e917ecfc7ca (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
! { dg-do run }
!
! PR 40594: [4.5 Regression] wrong-code
!
! Original test case by Daniel Franke <dfranke@gcc.gnu.org>
! Modified by Janus Weil <janus@gcc.gnu.org>

MODULE atom_types

TYPE :: atom_list
  TYPE(atom_private), DIMENSION(:), pointer :: table
END TYPE

TYPE :: atom_private
  TYPE(atom_list) :: neighbours
  LOGICAL         :: initialized = .true.
END TYPE

TYPE :: atom_model
  TYPE(atom_list) :: atoms
  integer         :: dummy
END TYPE

contains

  SUBROUTINE init(this)
    TYPE(atom_private) :: this
    this%initialized = .FALSE.
  END SUBROUTINE

END MODULE


program pr40594

  USE atom_types
  TYPE(atom_model) :: am
  type(atom_private) :: ap

  am%dummy = 0

  call init(ap)
  if (ap%initialized .neqv. .false.) call abort()

END

! { dg-final { cleanup-modules "atom_types" } }