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.

2 Answers 2

18

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.

3
  • 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, 2017 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, 2017 at 17:46
  • FYI if you have intel fortran compiler, the compiler flag is -extend-source which gets you 132 max line length. i do not know if there is a 'switch like -ffree-line-length. Jan 5, 2022 at 20:49
3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.