From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: integer overflow Date: Fri, 05 Mar 2010 22:11:35 -0500 Message-ID: <873a0euot4.fsf@stupidchicken.com> References: <4B8147A9.7030504@gmail.com> <87ljemdzxo.fsf@stupidchicken.com> <4B83682D.5010804@gnu.org> <87vddmpw4s.fsf@stupidchicken.com> <87hbp2fwoi.fsf@gnu.org> <87wrxrr4md.fsf@gnu.org> <3vsk8ecg6a.fsf@fencepost.gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1267845117 16056 80.91.229.12 (6 Mar 2010 03:11:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 6 Mar 2010 03:11:57 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: Glenn Morris Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 06 04:11:49 2010 connect(): Connection refused Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NnkQd-00025e-Hj for ged-emacs-devel@m.gmane.org; Sat, 06 Mar 2010 04:11:47 +0100 Original-Received: from localhost ([127.0.0.1]:57295 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NnkQc-0008K5-8y for ged-emacs-devel@m.gmane.org; Fri, 05 Mar 2010 22:11:46 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NnkQW-0008K0-KO for emacs-devel@gnu.org; Fri, 05 Mar 2010 22:11:40 -0500 Original-Received: from [140.186.70.92] (port=56888 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NnkQU-0008Js-QI for emacs-devel@gnu.org; Fri, 05 Mar 2010 22:11:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NnkQU-0001vS-8G for emacs-devel@gnu.org; Fri, 05 Mar 2010 22:11:38 -0500 Original-Received: from pantheon-po25.its.yale.edu ([130.132.50.119]:37627) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NnkQS-0001vC-SR; Fri, 05 Mar 2010 22:11:36 -0500 Original-Received: from furry (dhcp128036204168.central.yale.edu [128.36.204.168]) (authenticated bits=0) by pantheon-po25.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o263BZjA007165 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 5 Mar 2010 22:11:35 -0500 Original-Received: by furry (Postfix, from userid 1000) id 950E056CC01; Fri, 5 Mar 2010 22:11:35 -0500 (EST) In-Reply-To: <3vsk8ecg6a.fsf@fencepost.gnu.org> (Glenn Morris's message of "Fri, 05 Mar 2010 21:55:25 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.93 (gnu/linux) X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:121670 Archived-At: Glenn Morris writes: > I don't really understand it. In a 32-bit Emacs: > > (1+ 536870911) -536870912 > (+ 2 536870911) -536870911 > (1+ 536870912) 536870913.0 > (1+ 4294967295) overflow > (1+ 4294967295.0) 4294967296.0 > > Can you summarize how it's supposed to work? The change affects the Lisp reader: reading "536870912" or any larger number now gives you a float Lisp object, instead of an integer Lisp object (since there is no way to represent 536870912 or larger as integers). 536870911 and below are still read as integers. The change does not prevent the possibility of overflowing integers, as your example shows.