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 tdep/22891] New: Wrong conversion to `unsigned long long` for large `double` values


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

            Bug ID: 22891
           Summary: Wrong conversion to `unsigned long long` for large
                    `double` values
           Product: gdb
           Version: 8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tdep
          Assignee: unassigned at sourceware dot org
          Reporter: b7.10110111 at gmail dot com
  Target Milestone: ---

Example C++ program:

#include <iostream>
int main()
{
    const unsigned long long ull=0x9876543212345678ull;
    const double d=ull;
    const unsigned long long dull=d;
    std::cout.precision(35);
    std::cout << "ull : " << ull << "\n"
              << "d   : " << d << "\n"
              << "dull: " << dull << "\n"
              << "\n";
}

And here's the GDB command line

gdb -ex 'b 7' -ex r -ex 'p (unsigned long long)d' -ex 'p dull' ./test

I get the following as output on an x86 system:
$1 = 9223372036854775807
$2 = 10986060915047421952

The bug reproduces on i686-pc-linux-gnu GDB versions 8.1.50.20180205-git and
7.7.1, but it doesn't reproduce on armv6l-unknown-linux-gnueabihf GDB
8.0.50.20170811-git  — there I get identical values, the same as printed by the
test program itself.

-- 
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]