This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/20816] New: gdb expression parser seems to ignore "LL"-suffix
- From: "lvml at 5t9 dot de" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Mon, 14 Nov 2016 10:53:03 +0000
- Subject: [Bug gdb/20816] New: gdb expression parser seems to ignore "LL"-suffix
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=20816
Bug ID: 20816
Summary: gdb expression parser seems to ignore "LL"-suffix
Product: gdb
Version: 7.12.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: lvml at 5t9 dot de
Target Milestone: ---
To reproduce, on a x86_64 system, just start gdb, then type:
> (gdb) p (double)(-0x8000000000000000LL)
> $10 = 9.2233720368547758e+18
> (gdb) p (double)0x8000000000000000LL
> $2 = 9.2233720368547758e+18
> (gdb) p (double)-9223372036854775808LL
> $8 = 9.2233720368547758e+18
The constants "0x8000000000000000LL", "-0x8000000000000000LL" and
"-9223372036854775808LL" should all be negative numbers, shouldn't they?
Mysteriously, casting the already long-long-constant into (long long) yields
the expected result:
> (gdb) p ((double)(long long)0x8000000000000000LL)
> $1 = -9.2233720368547758e+18
> (gdb) p (double)(long long)-9223372036854775808LL
> $12 = -9.2233720368547758e+18
Doing the same conversions as in the example above with a smaller absolute
value does yield the expected result:
> (gdb) p (double)-9223372036854775807LL
> $23 = -9.2233720368547758e+18
(Since 9223372036854775808LL cannot be represented in 64bit, but
-9223372036854775808LL can, my guess would be that at some point, the value and
its sign are stored separately and then somehow lost.)
--
You are receiving this mail because:
You are on the CC list for the bug.