https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78171
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |kargl at gcc dot gnu.org Resolution|--- |WONTFIX --- Comment #1 from kargl at gcc dot gnu.org --- (In reply to Patrick Seewald from comment #0) > This should not compile because 'foo' is undefined: > > PROGRAM example > IMPLICIT NONE > REAL, ALLOCATABLE, DIMENSION(:) :: array > CALL foo(array) > END PROGRAM example > > However it compiles with 'gfortran -O1 -fcheck=pointer example.f90'. If I > run the executable, I get: > > At line 4 of file example.f90 > Fortran runtime error: Allocatable actual argument 'array' is not allocated A Fortran processor is not required to diagnosis this problem. It is the programmers responsibility to ensure that 'array' has been allocated before it is referenced. F2008, p. 129 An allocatable variable has a status of "unallocated" if it is not allocated. The status of an allocatable variable becomes unallocated if it is deallocated (6.7.3) or if it is given that status by the allocation transfer procedure. An allocatable variable with this status shall not be referenced or defined. It shall not be supplied as an actual argument corresponding to a nonallocatable dummy argument, except to certain intrinsic inquiry functions. Those "shall not"s in the above passage from the standard are prohibitions on the programmer. While the above code is trivial and doing a compile-time check may seem easy, it is rather daunting in a general case and can to lead to a substantial performance impact for correctly written code. This is why '-fcheck = ' exists. It allows a programmer to turn on additional checking, and should be used during development and testing.