Consider the fixed-format file routines.f
:
subroutine foo(n)
implicit none
integer n
n = n + 1
return
end
subroutine bar(n)
implicit none
integer n
n = 2*n
return
end
end
This compiles without errors or warnings with gfortran and ifort. If I remove the final end
statement, it still compiles with no complaints. Is there a simple explanation for the role of the final end
and why it is optional? Is the code “more correct” with or without the final end
?
This issue came up in some Fortran code that is wrapped by SciPy; see MAINT Add an extra END to prini.f by hoodmane · Pull Request #15954 · scipy/scipy · GitHub. Apparently f2c
requires the final end
statement, so the pyodide project has to patch a Fortran file to get f2c
to work.
Warren