public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* another IEE related problem
@ 1997-11-19 19:21 Ulrich Drepper
  1997-12-10  3:32 ` Bernd Schmidt
  0 siblings, 1 reply; 6+ messages in thread
From: Ulrich Drepper @ 1997-11-19 19:21 UTC (permalink / raw)
  To: egcs

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1997-12-10 19:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-11-19 19:21 another IEE related problem Ulrich Drepper
1997-12-10  3:32 ` Bernd Schmidt
1997-12-10  7:26   ` Ulrich Drepper
1997-12-10 10:58   ` Ulrich Drepper
1997-12-10 19:56   ` Jeffrey A Law
1997-12-10 19:28     ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).