This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

another IEE related problem


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   `------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]