Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Bug in valarith.c:value_equal()?
@ 2005-02-08 10:11 Mark Kettenis
  2005-02-08 15:46 ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Kettenis @ 2005-02-08 10:11 UTC (permalink / raw)
  To: gdb

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



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

end of thread, other threads:[~2005-02-09  0:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-08 10:11 Bug in valarith.c:value_equal()? Mark Kettenis
2005-02-08 15:46 ` Andrew Cagney
2005-02-09  1:34   ` M.M. Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox