GDB cannot evaluate hexadecimal floating-point numbers with negative exponent

Bug #1448146 reported by Hugues de Lassus Saint-Geniès
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gdb (Ubuntu)
New
Undecided
Unassigned

Bug Description

Trying to print a hexadecimal floating-point number evaluates to a wrong double.
This makes fp-based programs harder to debug.
In the example below, the parser seems to recognize 0xa.0p as (double)10 and 4 as an int, and a subtraction '-', thus the result '6'.

GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) print /f 0xa.0p-4
$1 = 6

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: gdb 7.7.1-0ubuntu5~14.04.2
ProcVersionSignature: Ubuntu 3.13.0-49.83-generic 3.13.11-ckt17
Uname: Linux 3.13.0-49-generic x86_64
NonfreeKernelModules: wl
ApportVersion: 2.14.1-0ubuntu3.10
Architecture: amd64
CurrentDesktop: Unity
Date: Fri Apr 24 15:43:39 2015
InstallationDate: Installed on 2014-11-06 (168 days ago)
InstallationMedia: Ubuntu 14.04.1 LTS "Trusty Tahr" - Release amd64 (20140722.2)
SourcePackage: gdb
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Hugues de Lassus Saint-Geniès (huguesdelassus) wrote :
description: updated
Revision history for this message
Hugues de Lassus Saint-Geniès (huguesdelassus) wrote :

A bug was filed on Sourceware Bugzilla for GDB at https://www.sourceware.org/bugzilla/show_bug.cgi?id=18318 as it affects GDB 7.9 too.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.