OSDN Git Service

PR c++/41920
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / whole_file_14.f90
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 !
8 module global
9  type                                ::  mytype
10    type(mytype),pointer   ::  this
11  end type mytype
12  type(mytype),target        :: base
13 end module global
14
15 program 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)
21 contains
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
27 end program test_equi
28 ! { dg-final { cleanup-modules "global" } }