public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/18702] New: FPU registers with exponent values exceeding those of float64 are shown as 0 or inf
@ 2015-07-21 15:05 b7.10110111 at gmail dot com
  2015-07-21 15:06 ` [Bug gdb/18702] " b7.10110111 at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: b7.10110111 at gmail dot com @ 2015-07-21 15:05 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 18702
           Summary: FPU registers with exponent values exceeding those of
                    float64 are shown as 0 or inf
           Product: gdb
           Version: 7.9
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: b7.10110111 at gmail dot com
  Target Milestone: ---

Example C++ program:

#include <iostream>
#include <cstring>

int main()
{
    char xi[]={0xe0,0x7c,0x39,0x27,0x05,0x8e,0x7a,0x86,0x1a,0x36};
    long double x;
    std::memcpy(&x,xi,sizeof x);
    std::cout << "x="<<x*1.235L<<"\n";
    char yi[]={0xab,0xfd,0x3c,0xdd,0x1d,0x4a,0x45,0x88,0xf9,0xc4};
    long double y;
    std::memcpy(&y,yi,sizeof y);
    std::cout << "x="<<y*1.235L<<"\n";
}  


If you compile it without optimization and break at `fmulp` instruction at the
point of `x*1.235L` or `y*1.235L`, and then continue and do `info float`,
you'll get for the case with `x`

  R7: Valid   0x361a867a8e0527397ce0 +0                         
=>R6: Valid   0x3fff9e147ae147ae147b +1.235                     
  R5: Empty   0x00000000000000000000

and for the case with `y`

  R7: Valid   0xc4f988454a1ddd3cfdab -inf                       
=>R6: Valid   0x3fff9e147ae147ae147b +1.235                     
  R5: Empty   0x00000000000000000000

But clearly the values in R7 should be (approximately) 3.25435e-763 and
-3.46264e+383 respectively, which you get printed to stdout if you run the
program to the end.

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


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

* [Bug gdb/18702] FPU registers with exponent values exceeding those of float64 are shown as 0 or inf
  2015-07-21 15:05 [Bug gdb/18702] New: FPU registers with exponent values exceeding those of float64 are shown as 0 or inf b7.10110111 at gmail dot com
@ 2015-07-21 15:06 ` b7.10110111 at gmail dot com
  2015-07-25  5:23 ` b7.10110111 at gmail dot com
  2015-08-07 15:22 ` b7.10110111 at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: b7.10110111 at gmail dot com @ 2015-07-21 15:06 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Ruslan <b7.10110111 at gmail dot com> ---
> which you get printed to stdout if you run the program to the end.
I mean which you'd get if you changed 1.235L to 1.L.

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


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

* [Bug gdb/18702] FPU registers with exponent values exceeding those of float64 are shown as 0 or inf
  2015-07-21 15:05 [Bug gdb/18702] New: FPU registers with exponent values exceeding those of float64 are shown as 0 or inf b7.10110111 at gmail dot com
  2015-07-21 15:06 ` [Bug gdb/18702] " b7.10110111 at gmail dot com
@ 2015-07-25  5:23 ` b7.10110111 at gmail dot com
  2015-08-07 15:22 ` b7.10110111 at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: b7.10110111 at gmail dot com @ 2015-07-25  5:23 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Ruslan <b7.10110111 at gmail dot com> ---
Forgot to say, I tested this on Kubuntu 14.04. Also, I've noticed that this
reproduces only on a 64 bit version, while 32 bit works correctly.

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


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

* [Bug gdb/18702] FPU registers with exponent values exceeding those of float64 are shown as 0 or inf
  2015-07-21 15:05 [Bug gdb/18702] New: FPU registers with exponent values exceeding those of float64 are shown as 0 or inf b7.10110111 at gmail dot com
  2015-07-21 15:06 ` [Bug gdb/18702] " b7.10110111 at gmail dot com
  2015-07-25  5:23 ` b7.10110111 at gmail dot com
@ 2015-08-07 15:22 ` b7.10110111 at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: b7.10110111 at gmail dot com @ 2015-08-07 15:22 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Ruslan <b7.10110111 at gmail dot com> ---
Created attachment 8493
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8493&action=edit
Proposed fix

This seems to be caused by failed detection of x86_64 host. This results in
GDB_HOST_{FLOAT,DOUBLE,LONG_DOUBLE}_FORMAT being set to 0 and prevent
floatformat_to_doublest() from working as expected.

The patch fixes host detection.

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


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

end of thread, other threads:[~2015-08-07 15:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-21 15:05 [Bug gdb/18702] New: FPU registers with exponent values exceeding those of float64 are shown as 0 or inf b7.10110111 at gmail dot com
2015-07-21 15:06 ` [Bug gdb/18702] " b7.10110111 at gmail dot com
2015-07-25  5:23 ` b7.10110111 at gmail dot com
2015-08-07 15:22 ` b7.10110111 at gmail dot com

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).