Author Topic: Converting older fortran files to .f90  (Read 2926 times)

Offline LeoIgor

  • Single posting newcomer
  • *
  • Posts: 2
Converting older fortran files to .f90
« on: July 08, 2018, 10:56:10 pm »
Hello!
I have the source code for a program that was written in Fortran 77 (iFILE.F).
I get many compiler errors when I try to compile this file. I believe the problem is that many of the lines of code exceed the 72 columns allowed in Fortran 77. I want to convert this file to a .f90. Is there a simple command for CodeBlocks, command line or some fortran programm that I can use to convert this file or do I have to do it manually?

Offline gd_on

  • Lives here!
  • ****
  • Posts: 797
Re: Converting older fortran files to .f90
« Reply #1 on: July 09, 2018, 08:59:22 am »
have a look at gfortran compilation options (https://gcc.gnu.org/onlinedocs/gfortran/Option-Summary.html or https://gcc.gnu.org/onlinedocs/gfortran/Fortran-Dialect-Options.html#Fortran-Dialect-Options and many other web pages ...)
If your problem is the length of lines, you can add options as  -ffixed-line-length-none or -ffree-line-length-none  or -ffixed-line-length-n or -ffree-line-length-n (n max number of characters in the line).
You can also try to change the extension of the file : .F and .f have not the same defaults compilation options for example.

Anf, if you are on Windows, don't use TDM gfortran 5.1 : it's bugged !

gd_on
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.4 (tests with 3.3), Msys2 Compilers 13.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline LeoIgor

  • Single posting newcomer
  • *
  • Posts: 2
Re: Converting older fortran files to .f90
« Reply #2 on: July 09, 2018, 10:55:44 am »
have a look at gfortran compilation options (https://gcc.gnu.org/onlinedocs/gfortran/Option-Summary.html or https://gcc.gnu.org/onlinedocs/gfortran/Fortran-Dialect-Options.html#Fortran-Dialect-Options and many other web pages ...)
If your problem is the length of lines, you can add options as  -ffixed-line-length-none or -ffree-line-length-none  or -ffixed-line-length-n or -ffree-line-length-n (n max number of characters in the line).
You can also try to change the extension of the file : .F and .f have not the same defaults compilation options for example.

Anf, if you are on Windows, don't use TDM gfortran 5.1 : it's bugged !

gd_on

Thank you!