Reg-stack and cmove bug
Zack Weinberg
zackw@Stanford.EDU
Fri Feb 16 12:28:00 GMT 2001
On Fri, Feb 16, 2001 at 07:46:24PM +0100, Jan Hubicka wrote:
>
> Zack: can you verify that the testcase is really happy now? My patch
> changes the code in way I want, but I don't have f77 runtime to actually
> run it.
It works. I have constructed a test case suitable for inclusion into
the test suite, and run it with and without the patch:
$ ./g77 -Bstage2/ -O2 -march=pentiumpro -ffast-math test.f \
-L ../i686-pc-linux-gnu/libf2c/
$ ./a.out ; echo $?
5 9. 10. 0.100000001 0.
Fortran abort routine called
Aborted
134
$ ./g77 -B./ -O2 -march=pentiumpro -ffast-math test.f \
-L ../i686-pc-linux-gnu/libf2c/
$ ./a.out ; echo $?
0
$
I'm going to create a g77.dg directory for such tests and check it in
there. The patch should be applied to the 3.0 branch as well as the
mainline; this is a regression from 2.95.
zw
C Test for bug in reg-stack handling conditional moves.
C Reported by Tim Prince <tprince@computer.org>
C
C { dg-do run { target "i[6789]86-*-*" } }
C { dg-options "-O2 -ffast-math -march=pentiumpro" }
double precision function foo(x, y)
implicit none
double precision x, y
double precision a, b, c, d
if (x /= y) then
if (x * y >= 0) then
a = abs(x)
b = abs(y)
c = max(a, b)
d = min(a, b)
foo = 1 - d/c
else
foo = 1
end if
else
foo = 0
end if
end
program test
implicit none
integer ntests
parameter (ntests=7)
double precision tolerance
parameter (tolerance=1.0D-6)
C Each column is a pair of values to feed to foo,
C and its expected return value.
double precision a(ntests) /1, -23, -1, 1, 9, 10, -9/
double precision b(ntests) /1, -23, 12, -12, 10, 9, -10/
double precision x(ntests) /0, 0, 1, 1, 0.1, 0.1, 0.1/
double precision foo
double precision result
integer i
do i = 1, ntests
result = foo(a(i), b(i))
if (abs(result - x(i)) > tolerance) then
print *, i, a(i), b(i), x(i), result
call abort
end if
end do
end
More information about the Gcc-bugs
mailing list