(4) One also needs to remove EXTERNAL declarations from the code, since for example the code below will not compile if the commented out lines are reinstated:
module m
contains
function square(i) result(i2)
implicit none
integer, intent(in) :: i
integer :: i2
i2 = i**2
end function square
function cube(i) result(i3)
implicit none
integer, intent(in) :: i
integer :: i3
! external square
i3 = i * square(i)
end function cube
end module m
program main
use m
implicit none
! external cube
print*,cube(5)
end program main