This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
another IEE related problem
- To: egcs at cygnus dot com
- Subject: another IEE related problem
- From: Ulrich Drepper <drepper at ipd dot info dot uni-karlsruhe dot de>
- Date: 20 Nov 1997 04:20:49 +0100
- Reply-To: drepper at ipd dot info dot uni-karlsruhe dot de (Ulrich Drepper)
Hi,
Compiling this little piece of code on a ix86 machine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
extern inline float
bar (float x)
{
float res;
asm ("fsqrt" : "=t" (res) : "0" (x));
return res;
}
extern float fabsf (float);
float
foo (float x)
{
float res = fabsf (bar (x));
return res;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The generated code with -O3 -momit-leaf-frame-pointer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foo:
flds 4(%esp)
#APP
fsqrt
#NO_APP
ret
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is wrong. In the real code I added the `fabs' in full knowledge
of the situation. The problem is that according to IEEE
sqrt(-0.0) == -0.0
and so I get a wrong result. I don't know why gcc thinks the
fabs call is redundant (it should not be able to analyze the asm
statement) but in any case it is plainly wrong.
Another bug preventing the glibc test suite to be passed.
-- Uli
---------------. drepper at gnu.org ,-. Rubensstrasse 5
Ulrich Drepper \ ,-------------------' \ 76149 Karlsruhe/Germany
Cygnus Solutions `--' drepper at cygnus.com `------------------------