This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: A tale of three compilers


Paul Thomas wrote:
> module global
>   type                                ::  mytype
>      type(mytype),pointer   ::  this
>   end type mytype
>   type(mytype),target        :: base
> end module global
> program test_equi
>   use global
>   call check()
>   print *, "base%this%this=>base?"  ,  associated(base%this%this,base)
>   print *, "base%this%this=>?" ,          associated(base%this%this)
>   print *, "base%this=>?" ,                   associated(base%this)
> contains
>   subroutine check()
>   type(mytype),target        :: j
>   base%this => j                      !have the variables point
>   j%this => base                      !to one another
>   end subroutine check             !take j out of scope
> end program test_equi

See note 14.13 and paragraph 14.6.2.1.3 no. 3 in the Fortran 95 standard. The
status of base%this is undefined after leaving the subroutine.

HTH
- Tobi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]