gcc optimizer problem

Toon Moene toon@moene.indiv.nluug.nl
Tue Apr 7 17:08:00 GMT 1998


>  I'm a member of a large collaboration performing research
>  in high energy physics ( http://www-h1.desy.de ) and I have
>  a problem with the GCC optimizer for some Fortran code
>  on a PC running Linux. The code performs only correct
>  without optimization (-O0).

>  The compiler options used are:
>   g77 -c -w -fno-automatic -finit-local-zero -O2
>   -fno-second-underscore
>       -fno-backslash gcc -c -w -ansi -O2

*
*                 isolated maximum found,check it
*
*                 worse isolation?
                  FRAC=FLOAT(MT)/FLOAT(NTOT)
CHK the magic print statement		
C                  PRINT *, ' IXCLU1- '
CHK		
                  IF (FRAC.LT.FRACX) GOTO 500
                      ^^^^^^^^^^^^^

Could you try this routine compiled with the additional flag  
-ffloat-store ?  I bet the "adding this print solves the problem" is  
a dead give-away that FRAC normally is kept in a register, which  
gives it a slightly different value from when it has to be stored  
(which is the case around the calls resulting from the print  
statement).

Grrrr, don't you love the ix86 architecture :-(

HTH,
Toon.



More information about the Gcc-bugs mailing list