Dear all,
I think, the ifort compiler 16.0.0 and also previous ones behave strange, when turning on pointer checking ("-check pointers") and passing an unallocated array as actual argument to an optional array dummy argument in a subroutine. The code below compiles and runs fine without the "-check pointers" option, but triggers a false error during run-time when the option is turned on during the compilation.
Bálint
module testmod implicit none contains subroutine testSub(aa, bb) integer, intent(in) :: aa(:) integer, intent(in), optional :: bb(:) print *, "AA:", aa if (present(bb)) then print *, "BB:", bb else print *, "BB NOT PRESENT" end if end subroutine testSub end module testmod program test use testmod implicit none integer, allocatable :: aa(:), bb(:) allocate(aa(2)) aa(:) = -1 call testSub(aa, bb=bb) allocate(bb(2)) aa(:) = -2 bb(:) = -4 call testSub(aa, bb=bb) end program test