From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: EMACS_INT vs int for range checking Date: Sat, 26 May 2012 13:11:46 +0300 Message-ID: <8362bjw8t9.fsf@gnu.org> References: <4FC09ECC.5050206@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: dough.gmane.org 1338027116 11216 80.91.229.3 (26 May 2012 10:11:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 26 May 2012 10:11:56 +0000 (UTC) Cc: emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 26 12:11:55 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SYDyR-0004RO-UY for ged-emacs-devel@m.gmane.org; Sat, 26 May 2012 12:11:52 +0200 Original-Received: from localhost ([::1]:40990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYDyR-0002YH-F5 for ged-emacs-devel@m.gmane.org; Sat, 26 May 2012 06:11:51 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55465) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYDyO-0002YC-LL for emacs-devel@gnu.org; Sat, 26 May 2012 06:11:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SYDyM-0005wR-V4 for emacs-devel@gnu.org; Sat, 26 May 2012 06:11:48 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:49033) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYDyM-0005wN-Mm for emacs-devel@gnu.org; Sat, 26 May 2012 06:11:46 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0M4M00200JSMB100@a-mtaout20.012.net.il> for emacs-devel@gnu.org; Sat, 26 May 2012 13:11:44 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.210.75]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M4M002G6KBK2W90@a-mtaout20.012.net.il>; Sat, 26 May 2012 13:11:44 +0300 (IDT) In-reply-to: <4FC09ECC.5050206@cs.ucla.edu> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 80.179.55.166 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:150645 Archived-At: > Date: Sat, 26 May 2012 02:13:48 -0700 > From: Paul Eggert > CC: Emacs Development > > It's true that 'val' is supposed to be in range here, and > that if it is in range then 'int' will do. But the point of > the test '(v < 0 || v > MAX_CHAR)' is to abort if there is > some programming error somewhere that causes 'val' to be out of > range. Unfortunately the patch means the abort test won't > work reliably on a typical 64-bit host if XINT (val) is (say) 2**32, > which means that the programming error won't be detected reliably. That's not what that test is about. That test is about making sure the result is a valid character code. If we need protection against overflowing a 32-bit int, it should be part of CHAR_TABLE_REF, not in every place where CHAR_TABLE_REF is used.