can this be treated as bug in fortran?

Uttam Pawar uttamp@us.ibm.com
Wed Nov 16 18:25:00 GMT 2005


Hi,

I've a following case, where dangling pointer is not detected. I'll file
it as a bug report if it indeed is bug (i think it is) but still need an
opinion.

cat test2.f90
program test2
  integer, pointer :: ptr1(:)
  integer, pointer :: ptr2(:)
  allocate(ptr1(10))
  ptr1 = 10; ptr2 => ptr1
  call free_ptr
  ptr2 = 20
  print *, "should not reach here"
contains
  subroutine free_ptr
    deallocate(ptr1)
  end subroutine free_ptr
end program test2

May be I can do this with allocatable pointer too?

- Uttam



More information about the Fortran mailing list