cpp Preprocessor Cannot Parse *.f90 *.f95 *.f03 files
(Doc ID 1380627.1)
Last updated on DECEMBER 23, 2022
Applies to:
Oracle Solaris Studio - Version Forte Developer 6 Update 2 and laterInformation in this document applies to any platform.
Symptoms
Compilation of Fortran source files which contain preprocessor statements fail when cpp is used and the source file name is in lower case:
% more t.f90 t.include
::::::::::::::
t.f90
::::::::::::::
#include "t.include"
::::::::::::::
t.include
::::::::::::::
(empty file)
% f90 -V -fpp -xpp=cpp t.f90
f90: Sun Fortran 95 8.4 SunOS_sparc 2009/06/03
f90comp: Sun Fortran 95 8.4 SunOS_sparc 2009/06/03
#include "t.include"
^
"t.f90", Line = 1, Column = 1: ERROR: This statement must begin with a label, a keyword, or an identifier.
^
"t.f90", Line = 1, Column = 1: ERROR: All statements must be contained within a program unit and followed by END.
f90comp: 1 SOURCE LINES
f90comp: 2 ERRORS, 0 WARNINGS, 0 OTHER MESSAGES, 0 ANSI
::::::::::::::
t.f90
::::::::::::::
#include "t.include"
::::::::::::::
t.include
::::::::::::::
(empty file)
% f90 -V -fpp -xpp=cpp t.f90
f90: Sun Fortran 95 8.4 SunOS_sparc 2009/06/03
f90comp: Sun Fortran 95 8.4 SunOS_sparc 2009/06/03
#include "t.include"
^
"t.f90", Line = 1, Column = 1: ERROR: This statement must begin with a label, a keyword, or an identifier.
^
"t.f90", Line = 1, Column = 1: ERROR: All statements must be contained within a program unit and followed by END.
f90comp: 1 SOURCE LINES
f90comp: 2 ERRORS, 0 WARNINGS, 0 OTHER MESSAGES, 0 ANSI
In fact, the cpp preprocessor is not even called:
% f90 -V -fpp -xpp=cpp t.f90 -v
### command line files and options (expanded):
### -V -xpp=cpp t.f90 -v
f90: Sun Fortran 95 8.4 SunOS_sparc 2009/06/03
### f90: Note: NLSPATH = <STUDIO_INSTALL_DIR>/prod/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:<STUDIO_INSTALL_DIR>/prod/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat
<STUDIO_INSTALL_DIR>/prod/bin/f90comp -y-o -yt.o -V -ev -y-ftrap=common -m3 -dq -y-fbe -y<STUDIO_INSTALL_DIR>/prod/bin/fbe -y-xarch=generic -y-td -y/tmp/<USERNAME> -y-s -H "<STUDIO_INSTALL_DIR>/prod/bin/f90 -fpp -xpp=cpp -v " -y-xcache=generic -xcache=generic -xivdep=loop -I<STUDIO_INSTALL_DIR>/prod/include/f95/v8 -p<STUDIO_INSTALL_DIR>/prod/lib/modules -y-verbose -xall -xmemalign=8i -y-xmemalign=8i -y-xdbggen=no%stabs+dwarf2 -y-xdbggen=incl -xassume_control=optimize -y-xassume_control=optimize -iorounding=processor-defined -xhasc=yes t.f90 /tmp/<USERNAME>/f90comp.29766.s.0.s
f90comp: Sun Fortran 95 8.4 SunOS_sparc 2009/06/03
#include "t.include"
^
"t.f90", Line = 1, Column = 1: ERROR: This statement must begin with a label, a keyword, or an identifier.
^
"t.f90", Line = 1, Column = 1: ERROR: All statements must be contained within a program unit and followed by END.
f90comp: 1 SOURCE LINES
f90comp: 2 ERRORS, 0 WARNINGS, 0 OTHER MESSAGES, 0 ANSI
### command line files and options (expanded):
### -V -xpp=cpp t.f90 -v
f90: Sun Fortran 95 8.4 SunOS_sparc 2009/06/03
### f90: Note: NLSPATH = <STUDIO_INSTALL_DIR>/prod/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:<STUDIO_INSTALL_DIR>/prod/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat
<STUDIO_INSTALL_DIR>/prod/bin/f90comp -y-o -yt.o -V -ev -y-ftrap=common -m3 -dq -y-fbe -y<STUDIO_INSTALL_DIR>/prod/bin/fbe -y-xarch=generic -y-td -y/tmp/<USERNAME> -y-s -H "<STUDIO_INSTALL_DIR>/prod/bin/f90 -fpp -xpp=cpp -v " -y-xcache=generic -xcache=generic -xivdep=loop -I<STUDIO_INSTALL_DIR>/prod/include/f95/v8 -p<STUDIO_INSTALL_DIR>/prod/lib/modules -y-verbose -xall -xmemalign=8i -y-xmemalign=8i -y-xdbggen=no%stabs+dwarf2 -y-xdbggen=incl -xassume_control=optimize -y-xassume_control=optimize -iorounding=processor-defined -xhasc=yes t.f90 /tmp/<USERNAME>/f90comp.29766.s.0.s
f90comp: Sun Fortran 95 8.4 SunOS_sparc 2009/06/03
#include "t.include"
^
"t.f90", Line = 1, Column = 1: ERROR: This statement must begin with a label, a keyword, or an identifier.
^
"t.f90", Line = 1, Column = 1: ERROR: All statements must be contained within a program unit and followed by END.
f90comp: 1 SOURCE LINES
f90comp: 2 ERRORS, 0 WARNINGS, 0 OTHER MESSAGES, 0 ANSI
Changes
The problem shows up only with Sun Studio 12 Update 1/f90 8.4 and earlier.
Cause
To view full details, sign in with your My Oracle Support account. |
|
Don't have a My Oracle Support account? Click to get started! |
In this Document
Symptoms |
Changes |
Cause |
Solution |