This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug in valarith.c:value_equal()?


Mark Kettenis wrote:

Your right, varobj should use bitwise comparison. Suggest a function value_content_equal.

Andrew

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





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