问题
I am editing an old project that uses fixed form Fortran and compiling with IVF compiler. The current issue I have is with continuation lines in a list:
format(//, 10x,'*******************************************',/, &
10x,'* DIAGONALS OF THE RESIDUAL COV. MATRIX *',/, &
10x,'*******************************************',//, &
2x,'MEASUREMENT',7X,' RESIDUAL COVARIANCE', /)
For some reason, the ampersand is not working for me and I keep getting the error:
unrecognized token '&' skipped
For smaller lines, increasing the fixed form line length and making the two lines one worked but there are instances where the lines are too large for this. The code was written around 15 years ago and in fixed form Fortran but I am unfamiliar with Fortran and how the new compiler and settings affect the code.
Converting to free form causes a series of errors with other formatting and the code does not seem broken so I do not think converting to free form is necessary. I have tried other methods of indenting, such as an ampersand at the end of a line and at the beginning of next, an asterisk, and a slash that other forums suggested using and they produce the error:
error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ) ...
Is there some sort of formatting I am missing or is there any settings I could edit to fix these errors?
Thanks, Gavin
回答1:
In fixed form Fortran, you continue a line with any character in column 6 of the next line, not an & at the end of the 1st line. Try:
format(//, 10x,'*******************************************',/,
c 10x,'* DIAGONALS OF THE RESIDUAL COV. MATRIX *',/,
c 10x,'*******************************************',//,
c 2x,'MEASUREMENT',7X,' RESIDUAL COVARIANCE', /)
回答2:
Or use the compiler switch -free with .for or .f
Or use the compiler switch -fixed -132 with a .F90 .
In your case I would preserve the .f and cp that to .F90 and then explicitly have the makefile compile the .F90 ...
I normally use -fixed -132 with a .F90 as I often have -d-lines that I retain in the code, and I could not get -d-lines. To work with -free.
来源:https://stackoverflow.com/questions/50519253/unrecognized-token-in-fixed-fortran-continuation-lines