gfortran -cpp sometimes confused by '/*'
sam tygier
samtygier@yahoo.co.uk
Thu Jun 25 15:34:00 GMT 2015
Hello,
I am trying to use some #ifdef in some fortran code in order to smooth
over a gfortran/ifort difference. This requires using the flag -cpp.
However this causes a line containing '\*' to be misinterpreted giving
the error:
Error: unterminated comment
I have tried with 5.1.1 and 4.7.2.
I can reduce the issue down to the program:
PROGRAM a
WRITE(*,FMT='( '' /* '' )')
WRITE(*,FMT='(
> '' /* '' )')
ENDPROGRAM
This compile and runs fine with out -cpp, but the second write statement
fails with -cpp. Maybe because the parser in cpp detects the first
instance as being within a string. In ifort it does not cause a problem.
While I can work around this, it seems like the wrong behaviour. Is this
a bug, or just an inherent limitation.
Thanks,
Sam
More information about the Fortran
mailing list