public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>
To: egcs@cygnus.com
Subject: next glibc showstopper
Date: Fri, 21 Nov 1997 21:50:00 -0000	[thread overview]
Message-ID: <x7yb2hpkyb.fsf@myware.rz.uni-karlsruhe.de> (raw)

Hi,

Here's the next problem which prevent successfully compiling the glibc
with the current egcs on ix86:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
double r (double, double);

extern inline int
bar (double x)
{
  union { double d; int i[2]; } u = { d: x }; return u.i[1] < 0;
}

int
foo (double d1, double d2)
{
  double e = r (d1, d2);

  if (bar (d1) && bar (e))		<---- PROBLEM
    return 1;
  else
    return 5;

  return 0;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The fault part of the code is this:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  12:   e8 fc ff ff ff  call   13 <foo+0x13>
  17:   dd 45 08        fldl   0x8(%ebp)
  1a:   dd 5d f8        fstpl  0xfffffff8(%ebp)

  if (bar (d1) && bar (e))
  1d:   83 7d fc 00     cmpl   $0x0,0xfffffffc(%ebp)
  21:   7d 0d           jnl    30 <foo+0x30>
  23:   dd 5d f8        fstpl  0xfffffff8(%ebp)   \ here is something
  26:   7d 0a           jnl    32 <foo+0x32>      / missing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

After the call to `r' (address 12) the return value is in %st(0).  The
according to the inline function `d1' is tested.  It is copied on the
stack (why?) and the correct word is tested against $0.  This is ok.

But now the return value must be checked.  Here only the storing
happens but NO compare instruction sets the flags.  I.e., the flags as
determined for `d1' are used.


-- Uli
---------------.      drepper at gnu.org  ,-.   Rubensstrasse 5
Ulrich Drepper  \    ,-------------------'   \  76149 Karlsruhe/Germany
Cygnus Solutions `--' drepper at cygnus.com   `------------------------

             reply	other threads:[~1997-11-21 21:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-21 21:50 Ulrich Drepper [this message]
1997-12-01  5:20 ` Bernd Schmidt
     [not found] <9712012221.AA15274@vlsi1.ultra.nyu.edu>
1997-12-03  5:46 ` Bernd Schmidt
1997-12-06  7:50   ` Jeffrey A Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=x7yb2hpkyb.fsf@myware.rz.uni-karlsruhe.de \
    --to=drepper@ipd.info.uni-karlsruhe.de \
    --cc=egcs@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).