bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Wrong arithmetic conversion


From: Abramo Bagnara
Subject: Wrong arithmetic conversion
Date: Wed, 08 Nov 2006 10:50:19 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; it; rv:1.8.0.8) Gecko/20061025 Thunderbird/1.5.0.8 Mnenhy/0.7.4.666

When evaluating comparison expressions, the "usual arithmetic
conversions" mandated by C standard (ISO/IEC 9899 #6.3.1.8) 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"

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 = true
(gdb) print 123456789123456784.0 < (double)123456789123456789LL
$4 = false


-- 
Abramo Bagnara                       mailto:address@hidden

Opera Unica                          Phone: +39.0546.656023
Via Emilia Interna, 140
48014 Castel Bolognese (RA) - Italy




reply via email to

[Prev in Thread] Current Thread [Next in Thread]