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 gdb/18702] New: FPU registers with exponent values exceeding those of float64 are shown as 0 or inf


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.


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