Failing to compile possibly outdated code

Disclaimer: I have no experience with Fortran, and I do not expect to use it for my research outside of this one case. This is why my goal (for now at least) is simply getting to code to run instead of really understanding the cause of the issues.

I’m trying to use publicly available Fortran code to analyze tidal constituents (computing nodal factors and equilibrium arguments).

I attempted to use an online Fortran compiler. After replacing “C” with “!” for comments, it still failed to compile. My guess is the code is for an older version of Fortran: one warning I got was “Warning: Fortran 2018 deleted feature: DO termination statement which is not END DO or CONTINUE with label 1 at (1)”, but I also got several errors. Here is the code in the online compiler.

Based on the code output, would anyone know if the errors are due to Fortran versions. If so, what might be the simplest way to successfully compile it?

Thank you!

If using gfortran try compiling with the -std=legacy option.

If that does not work, please mention what compiler and compiler options you are using and the name of the source file. Note that compilers treat .f and .f90 as fixed and free source form by default. If using fixed source form you don’t need to replace C with ! to indicate a comment.


What you posted are warnings not errors, the code compiles and runs fine with gfortran.
You need to pass the option -ffixed-form to the compiler since it’s Fixed Form Fortran and the only compiler assumes you are using Modern Free Form.

1 Like

Thank you! For some reason I thought it would be much more complicated to install fortran than it was (I used the latest release of gfortran). It compiled without error and when I ran the executable it created the output file as expected.