program rte1
  implicit none
  type::node_type
     class(node_type),pointer::parent,child
     integer::id
  end type node_type
  type(node_type),target::root
  allocate(root%child)
  root%child%parent=>root
  root%id=1
  root%child%id=2
  print *,root%child%id," is child of ",root%id,":"
  print *,root%child%parent%id,root%id,associated(root%child%parent,root)
  call check(root%child,root)
contains
    subroutine check(this,that)
    class(node_type),intent(in),target :: this
    class(node_type),intent(in),target :: that
    print *,this%id," is child of ",that%id,":"
    print *,this%parent%id,that%id,associated(this%parent,that)
    end subroutine check
end program rte1

------

This is two times the same code: inside the program and as subroutine. The
result (GNU Fortran (GCC) 4.6.0 20100627) is different:

           2  is child of            1 :
           1           1 T
           2  is child of            1 :
           1           1 F


-- 
           Summary: Associated() doesn't work in subroutine
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: boschmann at tp1 dot physik dot uni-siegen dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44696

Reply via email to