This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
g77-2.96 -ffast-math breaks min(), max()
- To: bug-gcc at gnu dot org
- Subject: g77-2.96 -ffast-math breaks min(), max()
- From: Timothy C Prince <tprince at myrealbox dot com>
- Date: Wed, 27 Oct 1999 22:52:01 GMT
This function is broken when compiled with any
version of g77-2.96 including 19991025, with
the options -O -march=pentiumpro -ffast-math. It does the
same running in i686-pc-linux-gnu and i586-pc-cygwin32. It
always
returns a 0. value when compiled with -ffast-math and any
optimization above -O0. No, eliminating the use of .eqv.
doesn't fix it. According to gdb, the value of y is always
set to zero, even when compiled with -fno-automatic, nor is
x set correctly. Is this to be expected?
The full source code is available in
ftp://members.aol.com/n8tm/lloops.shar.gz.
_________________________________________________
function relerr(u,v)
C********************************************
C
C RELERR - RELATIVE ERROR BETWEEN U,V (0.,1.)
C U - INPUT
C V - INPUT
C********************************************
C
implicitdoubleprecision (a-h,o-z)
C
call trace('RELERR ')
w= 0.00d0
if(u.ne.v)then
w= 1.00d0
if(u >= 0.eqv.v >= 0)then
a= abs(u)
b= abs(v)
x= max(a,b)
y= min(a,b)
if(x.ne.0.00d0)then
w= 1.00d0-y/x
endif
endif
endif
relerr= w
call track('RELERR ')
return
end