This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
GCC 3.3.1 Fortran compilation with -xf77-cpp-input
- From: Steve Edwards <edwardss at whl dot co dot uk>
- To: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Sat, 16 Aug 2003 11:40:14 +0000
- Subject: GCC 3.3.1 Fortran compilation with -xf77-cpp-input
Hi,
I have encountered a slight oddity when using g77 from GCC 3.3.1. This
does not appear to affect the ability of g77 to generate code but does
produce a number of warnings that I don't think should appear.
Using a simple test program:
program g77test
implicit none
print *,'test ok'
end
and compiling with:
g77 -o g77test -O2 -W -Wall -Wsurprising g77test.f
Generates no error messages. Adding -xf77-cpp-input:
g77 -o g77test -O2 -W -Wall -Wsurprising -xf77-cpp-input g77test.f
produces:
cc1: warning: ignoring command line option '-Wsurprising'
cc1: warning: (it is valid for Fortran but not the selected language)
cc1: warning: ignoring command line option '-ffortran-bounds-check'
cc1: warning: (it is valid for Fortran but not the selected language)
cc1: warning: ignoring command line option '-fno-f2c'
cc1: warning: (it is valid for Fortran but not the selected language)
I checked the -ffortran-bounds-check option with:
program g77test
implicit none
integer i
real a(10)
do i=1,11
a(i)=float(i)
print *,'test ok',a(i)
enddo
end
and compiled with:
g77 -o g77test -O2 -W -Wall -Wsurprising -fno-f2c -xf77-cpp-input
g77test.f
and it runs as expected, printing out 1 to 11. Adding
-ffortran-bounds-check correctly fails at run time with:
Subscript out of range on file line 10, procedure g77test.f/MAIN.
Attempt to access the 11-th element of variable a.
Aborted
so the fortran specific flags still look like they are working fine.
I'm not going to even think of digging into the GCC source code to try
and work out why - I'll leave that to the experts...
Steve
----------------------------------------------------------
----------------------------------------------------------