Compile quirky Fortran 77 code in a modern compiler

I am trying to compile a piece of software written in Fortran 77. I have to point out that I don’t know much about Fortran and would rather not change the code for this software, m not sure what software licensing is, and I I don’t know if I can redistribute my modified version.

The code compiles on OS X and Windows using the g77 compiler, which (quite easily) is available for these systems. However, I cannot get it to work with my Ubuntu distribution, since I can no longer grab gb for Ubuntu, and if I try to install the old version, it seems to overshadow my entire GCC installation. I tried to compile the code with both gfortran and g95, but it does not work with anything:

  • The code uses real variables as loop indices (yes, I know, a bad idea). g95 supports this with the -freal-loops option, but gfortran does not.
  • The code uses real variables to index into arrays that gfortran will support (with a warning), but g95 will not support.

Can anyone suggest a way to compile this code with these two ugly functions using a modern and easily accessible compiler like g95 or gfortran?

+4
source share
1 answer

Pass the -std=legacy argument to -std=legacy . Functions removed in F95, such as real-loop and array indices, should compile (possibly with a warning) in legacy mode.

+3
source

Source: https://habr.com/ru/post/1446329/


All Articles