This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug tdep/22891] New: Wrong conversion to `unsigned long long` for large `double` values
- From: "b7.10110111 at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Sun, 25 Feb 2018 17:34:16 +0000
- Subject: [Bug tdep/22891] New: Wrong conversion to `unsigned long long` for large `double` values
- Auto-submitted: auto-generated
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.