Red Hat Bugzilla – Bug 21376
Severe fortran optimization error
Last modified: 2005-10-31 17:00:50 EST
The g77 compiler shipped with RH7 is badly broken and almost unusable. The
following bug reported on the gcc-bugs list originally by Martin Kahlert as
a bug of the last snapshot is actually there in all snapshots I tried after
the gcc-2.95.2 release and in particular in the "gcc-2.96" shipped with
RedHat. It is practically impossible to compile correctly a medium/large
fortran code on RH7 because of this. I work at CERN and our MonteCarlo code
got *AT LEAST* seven miscompiled routines after a quick check (by the way
all our codes dump core within a minute because of this). Two of these
bugs are related to the example reported below, I quit to investigate the
others since until this one is fixed there is no point in wasting further
time (hopefully they are still the same problem). The bug has been reported
to gcc-bugs as fortran/893 by somebody else.
If it can be of any help, gcc-g77-2.95.2 compiles correctly the example,
proving how crazy RedHat was in sending out an official release with a very
poor and unchecked snapshot as compiler. At present no work of fortran
based scientific computation can be performed with RH7. The bugs disappear
switching off all optimizations but the CPU penalties are of course
unacceptable. Due to the severity of the problem(s) perhaps it would be
wise to warn thru the lists all fortran users and maybe provide an "ad hoc"
solution with an older compiler set for fortran (gcc-2.95.2 based?) built
for RH7 while waiting for a fix.
REAL*8 VALUE(3), TOLD, BK
DATA VALUE /0D0, 1D0, 2D0/
DATA TOLD /0D0/
DO I=1, 3
BK = VALUE(I)
IF(BK .GT. TOLD) GOTO 10
WRITE(*,*) 'Error: BK = ', BK
WRITE(*,*) 'No Error: BK = ', BK
g77 -O -o bug bug.f
Error: BK = 1.
Alfredo Ferrari || Tel.: +41.22.767.6119
C.E.R.N. || Fax.:
+41.22.767.7555 European Laboratory for Particle Physics||
SL Division / EET Project || e-mail:
1211 Geneva 23 || Alfredo.Ferrari@cern.ch
Thanks for reporting this, I've fixed this in
and am now waiting for feedback from other gcc developers before
I put it into RH rpms.
If you have any other issues, please report them as well.
Fixed in 2.96-65 and above.