Dear community,
I got confused with the output from the program below.
- Is the code valid Fortran?
- And is the Intel compiler right, or should the output be well defined (I was expecting 'F')?
The program passes null() as an actual argument to a subroutine polymorphic dummy pointer argument. The association status inside the subroutine is not consistently defined and depends on compiler-version and options (and can change when code is added):
module m implicit none type :: t end type contains subroutine test(p) class(t), pointer :: p print *, associated(p) end subroutine end module program p use m call test(null()) end program
! Results with "Intel(R) Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64"
! System: Red Hat Enterprise Linux Server release 7.4
!
! $ifort test.f90
! Version 14.0.4.211 Build 20140805: F
! Version 15.0.3.187 Build 20150407: F
! Version 16.0.4.258 Build 20160811: T
! Version 17.0.6.256 Build 20171215: T
! Version 18.0.1.163 Build 20171018: F
!
! $ifort test.f90 -O0
! Version 14.0.4.211 Build 20140805: F
! Version 15.0.3.187 Build 20150407: F
! Version 16.0.4.258 Build 20160811: T
! Version 17.0.6.256 Build 20171215: T
! Version 18.0.1.163 Build 20171018: T
Kind regards
Ferdinand
PS: From https://software.intel.com/en-us/node/679609 , I understand that null() should indeed work in this context.