When using perverted technique like: SUBROUTINE A INTEGER, ALLOCATABLE, DIMENSION(:), TARGET :: ARRAY INTEGER, POINTER, DIMENSION(:) :: ARRAY_PTR COMMON /AP/ ARRAY_PTR !for later use in another sub ALLOCATE(ARRAY(10)) ARRAY = 10 ARRAY_PTR => ARRAY END SUBROUTINE A SUBROUTINE B INTEGER, POINTER, DIMENSION(:) :: ARRAY_PTR COMMON /AP/ ARRAY_PTR !for later use in another sub print *, ARRAY_PTR(1) END SUBROUTINE one can figure out, that ARRAY will be free'd after finishing subroutine A (because it was not SAVE'd). But gfortran still allows to play such a trick. I think it would be nice to see warning in such case (pointing to data that will be lost after this scope)
I'm inclined to think that this should be closed with WONTFIX. Deallocation of an allocated array when a subprogram returns is a fundamental concept of Fortran. A user should know what to expect and code accordingly. I'll let one of the other gfortran contributors make a final determination of the merits of a warning.
I agree with Steve and have marked this as WONTFIX. You should use another pointer and allocate to that if you want to avoid the automatic deallocation on leaving scope. Paul