I am puzzled why this program compiles program ntest interface subroutine itakepointer(p) integer, dimension(:), pointer :: p => null() end subroutine itakepointer end interface end program ntest I do ifort -stand f95 -warn all ntest.f90 If I explicitly add `save' it fails program ntest interface subroutine itakepointer(p) integer, dimension(:), pointer, save :: p => null() end subroutine itakepointer end interface end program ntest ntest.f90(4): error #6453: The SAVE attribute conflicts with other declarations. [P] integer, dimension(:), pointer, save :: p => null() -----------------------------------------------^ compilation aborted for ntest.f90 (code 1) For me it seems the following part of the standard implies that those two programs should be equivalent and not confirming. http://j3-fortran.org/doc/standing/archive/007/97-007r2/ascii/c05.txt If initialization is =>NULL (), object-name shall be a pointer, and its initial association status is disassociated. Use of =>NULL () in a scoping unit is a reference to the intrinsic function NULL. The presence of initialization implies that object-name is saved, except for an object-name in a named common block or an object-name with the PARAMETER attribute. The implied SAVE attribute may be reaffirmed by explicit use of the SAVE attribute in the type declaration statement, or by inclusion of the object-name in a SAVE statement (5.2.4). ifort version 13.1.1 Linux 2.6.37.6-24-desktop #1 SMP PREEMPT 2012-10-18 22:36:08 +0200 x86_64 x86_64 x86_64 GNU/Linux
↧