16

Is there a way of disabling the line length limit in the gfortran compiler? I am porting from ifort to gfortran and I wonder if there is an easy way to do so without going through the code and introduce line continuation by hand everywhere where it is needed.

davidism
  • 121,510
  • 29
  • 395
  • 339
DaPhil
  • 1,509
  • 4
  • 25
  • 47

2 Answers2

17

Investigate the options

-ffixed-line-length
-ffree-line-length

GCC manual:

-ffixed-line-length-n

Set column after which characters are ignored in typical fixed-form lines in the source file... Popular values for n include 72 (the standard and the default), 80 (card image), and 132 (corresponding to “extended-source” options in some popular compilers). n may also be ‘none’, meaning that the entire line is meaningful and that continued character constants never have implicit spaces appended to them to fill out the line. -ffixed-line-length-0 means the same thing as -ffixed-line-length-none.

-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.

High Performance Mark
  • 77,191
  • 7
  • 105
  • 161
  • Could you please help me find which standard these (and, why not, all other) options have been introduced since? Thank you in advance. – Enlico Nov 22 '17 at 14:52
  • I apologize, but I simply haven't found it. I can find all options on gcc.gnu.org, still I couldn't find a table with a "introduced in" column. Can you at least tell me if I'm searching for an existing thing? Again, apologize. – Enlico Nov 22 '17 at 17:46
  • FYI if you have intel fortran compiler, [the compiler flag is `-extend-source` which gets you 132 max line length](https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/language-options/extend-source.html). i do not know if there is a 'switch like `-ffree-line-length`. – Trevor Boyd Smith Jan 05 '22 at 20:49
3

I used -ffree-line-length-none so that my extra long lines in the source code didn't cause errors

glwhart
  • 324
  • 1
  • 12