1! { dg-do run }
2! { dg-options "-fwhole-file -O3" }
3! Check that the derived types are correctly substituted when
4! whole file compiling.
5!
6! Contributed by Dominique d'Humieres  <dominiq@lps.ens.fr
7!
8module global
9 type                                ::  mytype
10   type(mytype),pointer   ::  this
11 end type mytype
12 type(mytype),target        :: base
13end module global
14
15program test_equi
16  use global
17  call check()
18  print *, "base%this%this=>base?"  ,  associated(base%this%this,base)
19  print *, "base%this%this=>?" ,          associated(base%this%this)
20  print *, "base%this=>?" ,                   associated(base%this)
21contains
22  subroutine check()
23    type(mytype),target        :: j
24    base%this => j                      !have the variables point
25    j%this => base                      !to one another
26  end subroutine check                  !take j out of scope
27end program test_equi
28