Bug 21376

Summary: Severe fortran optimization error
Product: [Retired] Red Hat Linux Reporter: Alfredo Ferrari <alfredo.ferrari>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: high Docs Contact:
Priority: high    
Version: 7.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-11-28 13:42:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Alfredo Ferrari 2000-11-27 15:56:21 UTC
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.

      PROGRAM BUG
      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
      ENDDO

      WRITE(*,*) 'Error: BK = ', BK
      STOP

 10   CONTINUE
      WRITE(*,*) 'No Error: BK = ', BK
      END

g77 -O -o bug bug.f
./bug
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
 Switzerland

Comment 1 Jakub Jelinek 2000-11-28 13:42:17 UTC
Thanks for reporting this, I've fixed this in
http://gcc.gnu.org/ml/gcc-patches/2000-11/msg01594.html
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.
Thanks.

Comment 2 Jakub Jelinek 2000-12-14 16:18:11 UTC
Fixed in 2.96-65 and above.