https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48958
Harald Anlauf <anlauf at gmx dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gmx dot de --- Comment #2 from Harald Anlauf <anlauf at gmx dot de> --- There are a few inquiry functions (SIZE, SHAPE, (L,U)BOUND) where such a diagnostic might be useful. It could be hidden behind one of the -fcheck options. However: Depending on the implementation, it might work only for ALLOCATABLE, where there is no undefined allocation status. For a POINTER, the status could be undefined, and it is not possible to discover this. (It is even nice to be able to find out what the last size was before deallocating the target of the pointer...) NAG does the following: % cat pr48958.f90 !integer, allocatable :: a(:) integer, pointer :: a(:) print *, size (a) end % nagfor -C pr48958.f90 && ./a.out NAG Fortran Compiler Release 5.3.1(907) [NAG Fortran Compiler normal termination] Runtime Error: pr48958.f90, line 3: Reference to undefined POINTER A Program terminated by fatal error Abort Not sure whether there are other compilers which can handle this.