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]

exp/2196: Wrong arithmetic conversion


>Number:         2196
>Category:       exp
>Synopsis:       Wrong arithmetic conversion
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 08 09:48:01 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     abramobagnara@tin.it
>Release:        unknown-1.0
>Organization:
>Environment:

>Description:
Evaluating comparison expressions the "usual arithmetic conversions" mandated by C standard are not done.

In the cases below note that GDB returns the mathematically correct result, but this is not conforming to C standard and to GDB documentation that says:
"The usual way to examine data in your program is with the `print'
command (abbreviated `p'), or its synonym `inspect'.  It evaluates and
prints the value of an expression of the language your program is
written in"
>How-To-Repeat:
(GNU gdb Red Hat Linux (6.3.0.0-1.134.fc5rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) print (float)123456792.0 > 123456789
$1 = true
(gdb) print (float)123456792.0 > (float)123456789
$2 = false
(gdb) print 123456789123456784.0 == 123456789123456789LL
$3 = false
(gdb) print 123456789123456784.0 == (double)123456789123456789LL
$4 = true
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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