I know the maximum columns in Fortran is 132, but I thought comments could exceed that indefinately. I have lines that contain long comments after the code. I get the following severe error with pgfortran “PGF90-S-0285-Source line too long” when the comments exceed about 250 columns. What are the rules on comment length with PGI Fortran? The program still builds in spite of the error. Can I ignore it?
I know the maximum columns in Fortran is 132, but I thought comments could exceed that indefinately.
It’s my understanding that the 132 character limit applies to a line where a line is defined as a sequence of one or more characters that can be Fortran statements, comments and INCLUDE lines. Though, the standard does say that you can have as many consecutive comment lines as you want.
The program still builds in spite of the error. Can I ignore it?
Since it’s a syntax error, compilation would stop and no object file would be created. I’m guessing that you might be picking up an old object and is why it’s building?
I did some more testing. Here are the results.
PGI Fortran allows a line to be up to 264 columns - exactly twice the spec. It doesn’t matter if the line is made of code or comments.
You are correct about the syntax error stopping the build. That was my mistake.
PGI Fortran allows a line to be up to 264 columns
Correct but it’s generally better to keep your code standard compliant to avoid porting issues when moving from one platform to another.
In my Fortran code i use macros to save code source lines. Unfortunately the preprocessor does not allow to insert newline so i need to replace them by “;”.
Code produced had some some very long lines more than 264 characters et it’s not possible to build it with pgf90.
I can build my program with ifort and gfortran without any problems. Does someone know the right flag or the solution to my problem because i want to use pgf90 to build my application.
Thanks for your help
The semicolon is a valid statement separator in Fortran 9X/2X, so it may be worthwhile to use another character not used in Fortran, such as ‘#’. This character can then be replaced with a new line before calling the compiler using, for example, tr.
Does not really help me because it adds a step before compilation.
I don’t understand why it’s limited to 264 characters. My source code lines are sometimes long but i know what i’m doing.
Will wait an update.
I’m sorry you are having issues, however, when using non-standard conforming code, you will always encounter portability issues The F2003 standard limits line length to 132 characters and anything beyond this would be considered non-standard conforming.
While you may not like it, the best advice would be for you to rewrite your macros so they adhere to Fortran line length limits. Then again, macros are not standard conforming either, so you may want to rethink using them at all.
I’m having exactly the same problem and have no idea how to approach it. It compiles fine with gfortran but I’m getting the "PGF90-S-0285-Source line too long"error when compiling with pgfortran each time I try to compile.
As I mentioned before, the Fortran standard defines the maximum line length to be 132 characters. Codes that have lines longer than that are non-standard conforming.
You’ll want to add continuations to break-up your long lines into multiple lines to make it standard compliant.