Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@gnu.org>
To: gdb@sources.redhat.com
Subject: Bug in valarith.c:value_equal()?
Date: Tue, 08 Feb 2005 10:11:00 -0000	[thread overview]
Message-ID: <200502080403.j1843N75006954@copland.sibelius.xs4all.nl> (raw)

I've found the cause of the testsuite problems I reported yesterday.
The additional testsuite failures are intermittent.  If you look
careful at the gdb.mi/mi-var-cmd.exp test you'll see that the test is
checking whether some uninitialized local variables have been changed.
The testsuite failures indicate that sometimes, the floating-point
variables change unexpectedly.  Some further investigation showed that
these unexpected changes happened when the (unitialized) variables
were NaNs.  All of a sudden things make sense.  The variables don't
really change.  GDB tries to determine whether a variable changes by
comparing its current value to a previous value.  This is done by
calling valarith.c:value_equal().  For floating-point variables, this
function does the following check:

    return value_as_double (arg1) == value_as_double (arg2);

Now in C this will return 0, if ARG1 and ARG2 are NaN, even if they
are bit for bit equal.

Actually I think the implementation of valarithm.c:value_equal() is
right; when GDB evaluates expressions NaN == NaN should be zero.
Therefore I think we shouldn't use this function when establishing
when a variable has been changed.  Does it make sense to simply do a
bit-for-bit comparison in that case?

Mark



             reply	other threads:[~2005-02-08  4:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-08 10:11 Mark Kettenis [this message]
2005-02-08 15:46 ` Andrew Cagney
2005-02-09  1:34   ` M.M. Kettenis

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=200502080403.j1843N75006954@copland.sibelius.xs4all.nl \
    --to=kettenis@gnu.org \
    --cc=gdb@sources.redhat.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