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]

can this be treated as bug in fortran?


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


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