This is the mail archive of the gdb-prs@sourceware.org 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]

[Bug c++/16687] GDB Reports Incorrect Hexadecimal Value when adding floats


https://sourceware.org/bugzilla/show_bug.cgi?id=16687

Hugues de Lassus Saint-GeniÃs <huguesdelassus at hotmail dot fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |huguesdelassus at hotmail dot fr

--- Comment #1 from Hugues de Lassus Saint-GeniÃs <huguesdelassus at hotmail dot fr> ---
This bug is very closely related to bug 15318, if not a duplicate.

0x4d8ef3c2 is the integer representing the IEEE-754 binary32 value 299792448,
which is the binary32 number closest to 3.1415 + 299792458.
0x11de7840 is the hexadecimal representation of the integer value 299792448.

Without the -g flag, gdb has no idea that "value" is a float, and thus treats
it as a raw integer. That's exactly why it outputs 0x4d8ef3c2.
With -g enabled, "value" is known to be a floating-point datum, and that is why
p/x value first converts (float)299792448 to an integer, and then to the
hexadecimal value of this integer (which is 0x11de7840).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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