problem parsing WRITE format string with continuation

problem parsing WRITE format string with continuation

The problem is very similar to the one described in an earlier thread
except it now does not required fixed format and occurs with ifort Version 12.0.3.
Compiling the attached example produces:

ForTests/CompCheck> ifort formatString2.f90

formatString2.f90(2): error #5145: Invalid blank/tab

WRITE(*,'(10x,"**** CALCULATIO'//'N **** Num. of nuclides)&


formatString2.f90(3): error #5120: Unterminated character constant



formatString2.f90(2): error #5082: Syntax error, found ''' when expecting one of: ( ...

WRITE(*,'(10x,"**** CALCULATIO'//'N **** Num. of nuclides)&


compilation aborted for formatString2.f90 (code 1)

Note that - as in the previous thread - the double quotes are just internal to the string and the // operator should concatenate the 2 strings delimited by single quotes. The placement of the concatenation and the line continuation in this particular output are the result of an automatic source transformation and I believe are syntactically correct. The attached file is formatString2.f90

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

You have the continuation character (&) inside the quoted text token (which is not terminated on the line). Try:

WRITE(*,'(10x,"**** CALCULATIO'//'N **** Num. of nuclides)'&

The code is legal and the compiler wrong in complaining. Here is what the standard says:

3 If a character context is to be continued, an & shall be the last nonblank character on the line and
4 shall not be followed by commentary. There shall be a later line that is not a comment; an & shall be
5 the first nonblank character on the next such line and the statement continues with the next character
6 following that &.

I will escalate this to the developers. - issue ID is DPD200169704. However, I personally find continued character constants distasteful and would suggest using concatenation as Jim suggests.

Retired 12/31/2016

This will be fixed for a compiler release later this year.

Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today