🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #1139

Wrong arithmetic conversion

#1139
From: Abramo Bagnara
Date: Wed, 08 Nov 2006 09:50
38 lines
3104 bytes
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:abramobagnara@tin.it

Opera Unica                          Phone: +39.0546.656023
Via Emilia Interna, 140
48014 Castel Bolognese (RA) - Italy
Technical Details
Message-ID: <mailman.475.1163387475.2155.bug-gdb@gnu.org>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f5053,82ea1c8e5aabff17,start
X-Google-Attributes: gidf5053,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mail
From: Abramo Bagnara <abramobagnara@tin.it>
Newsgroups: gnu.gdb.bug
Subject: Wrong arithmetic conversion
Date: Wed, 08 Nov 2006 10:50:19 +0100
Organization: Opera Unica
Lines: 40
Approved: bug-gdb@gnu.org
Message-ID: <mailman.475.1163387475.2155.bug-gdb@gnu.org>
NNTP-Posting-Host: lists.gnu.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit
X-Trace: news.Stanford.EDU 1163387476 5880 199.232.76.165 (13 Nov 2006 03:11:17 GMT)
X-Complaints-To: news@news.stanford.edu
Cc: The Parma Polyhedra Library developers' list <ppl-devel@cs.unipr.it>
To: bug-gdb@gnu.org
Envelope-to: bug-gdb@gnu.org
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
X-Enigmail-Version: 0.94.1.1
X-Mailman-Approved-At: Sun, 12 Nov 2006 22:11:07 -0500
X-BeenThere: bug-gdb@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "Bug reports for GDB, the GNU debugger" <bug-gdb.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-gdb>,
 <mailto:bug-gdb-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/bug-gdb>
List-Post: <mailto:bug-gdb@gnu.org>
List-Help: <mailto:bug-gdb-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-gdb>,
 <mailto:bug-gdb-request@gnu.org?subject=subscribe>