cpp Preprocessor Cannot Parse *.f90 *.f95 *.f03 files (Doc ID 1380627.1)

Last updated on AUGUST 03, 2016

Applies to:

Oracle Solaris Studio - Version Forte Developer 6 Update 2 to Sun Studio 12 Update 1 [Release 6.0 to 12]
Information 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


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 = /opt/sunstudio12.1/prod/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:/opt/sunstudio12.1/prod/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat
/opt/sunstudio12.1/prod/bin/f90comp -y-o -yt.o -V -ev -y-ftrap=common -m3 -dq -y-fbe -y/opt/sunstudio12.1/prod/bin/fbe -y-xarch=generic -y-td -y/tmp/tdehn -y-s -H "/opt/sunstudio12.1/prod/bin/f90 -fpp -xpp=cpp -v " -y-xcache=generic -xcache=generic -xivdep=loop -I/opt/sunstudio12.1/prod/include/f95/v8 -p/opt/sunstudio12.1/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/tdehn/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

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms