Is the gfortran flag -ffree-line-length-0 necessary for f95 files?

Is the gfortran flag -ffree-line-length-0 necessary for f95 files? My understanding is that if my Fortran file has the .f95 extension, gfortran will automatically apply the flag -ffree-line-length-0. Is my understanding correct?

As gfortran Manual
GNU Fortran Manual

-ffree-line-length-n

Set column after which characters are ignored in typical free-form lines in the source file. The default value is 132. n may be ‘none’, meaning that the entire line is meaningful. -ffree-line-length-0 means the same thing as -ffree-line-length-none.

if exceed, the compile error shows below

1.f90:3:132:

Error: Line truncated at (1) [-Werror=line-truncation]
1 Like

Yes, It’s good to put this “-ffree-line-length-none” on the command line with gfortran, otherwise, the default max line length is 132 characters, which I find to be miserably short for any modern 4K monitor. The next Fortran standard is set to hopefully resolve the need for this flag. I think the Intel compiler allows virtually unlimited line length, by default.

1 Like

Not answering your question, but I recommend not using the .f95 extension. The .f90 extension indicates that a code uses free source form, not that the code conforms to the Fortran 90 standard (which did introduce free source form).

3 Likes

so gfortran will use -ffree-line-length-0 by default in the future? when will this happen?

With the next standard release
https://j3-fortran.org/doc/year/19/19-138r1.txt

1 Like

A side question, is there any plan to make -fimplicit-none the default flag for gfortran?

2 Likes

Even if it would be default, flags like -std=f2018 would need to enable it again to conform with the respective standard.

1 Like

I know that there is the proposal to make it the default for fpm, but I am biased :wink: :smiley:

2 Likes