FTN95 fails to identify that the optional argument, i, in f2 is not present. I believe that the code is invalid Fortran, and that the External declaration in line 3 needs to be replaced by the commented-out Interface. As it is, FTN95 indicates that the optional argument, i, is present, whereas other compilers generate a run-time error. The argument i is correctly indicated as not present if the interface block is used. !
Module m1
Contains
Function f1(f)
Integer :: f1
Integer, External :: f
! Interface
! Function f(i)
! Integer :: f
! Integer, Intent(In), Optional :: i
! End Function f
! End Interface
!
f1 = f()
Return
End Function f1
End Module m1
!
Module m2
Contains
Function f2(i)
Integer :: f2
Integer, Intent(In), Optional :: i
!
print*,Present(i)
f2 = 0
!
Return
End Function f2
End Module m2
!
Program p
Use m1
Use m2
Integer :: i
i = f1(f2)
End Program p