It seems to me that ifort 16.0.3 has some difficulties with optional argument passing, when using the -standard-semantics option. The code below demonstrates the issue. The present() query in the subroutine returns false, although the actual argument is an allocated pointer. Changing the dummy argument to be an assumed-shape array cures the problem, the same way as leaving away the -standard-semantics option does it as well.
module bugtestmod implicit none contains subroutine optarg(array) real, intent(in), optional :: array(3,3) print *, 'PRESENT?', present(array) end subroutine optarg end module bugtestmod program bugtest use bugtestmod implicit none real, pointer :: array(:,:) allocate(array(3,3)) array(:,:) = 1.0 call optarg(array) end program bugtest
The specific option that triggers the problem is -fpscomp logicals, which is implied by -standard-semantics. It's not PRESENT that is the issue but rather the argument is being passed incorrectly, causing PRESENT to fail (and also the dummy argument to be unusable.) Why -fpscomp logicals should have such an effect, I have no idea, and I have asked the developers to figure it out. Issue ID is DPD200412406.
If you want a workaround, add -fpscomp nologicals.