From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ? Date: Fri, 23 Oct 2009 21:05:05 -0400 Message-ID: References: <83ws2lg44u.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1256346343 28864 80.91.229.12 (24 Oct 2009 01:05:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 24 Oct 2009 01:05:43 +0000 (UTC) Cc: t_tuneyosi@hotmail.com, Andreas Schwab , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 24 03:05:35 2009 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.50) id 1N1V4Z-0003rJ-6s for ged-emacs-devel@m.gmane.org; Sat, 24 Oct 2009 03:05:35 +0200 Original-Received: from localhost ([127.0.0.1]:42212 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N1V4Y-0002JE-Bz for ged-emacs-devel@m.gmane.org; Fri, 23 Oct 2009 21:05:34 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N1V4S-0002IO-Di for emacs-devel@gnu.org; Fri, 23 Oct 2009 21:05:28 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N1V4N-0002Gk-3f for emacs-devel@gnu.org; Fri, 23 Oct 2009 21:05:27 -0400 Original-Received: from [199.232.76.173] (port=44146 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N1V4M-0002Gh-TS for emacs-devel@gnu.org; Fri, 23 Oct 2009 21:05:22 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:40959 helo=ironport2-out.pppoe.ca) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N1V4K-0002jp-IO; Fri, 23 Oct 2009 21:05:20 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqEEABPw4UpLd/m0/2dsb2JhbACBUNgthD8EiCM X-IronPort-AV: E=Sophos;i="4.44,615,1249272000"; d="scan'208";a="48092923" Original-Received: from 75-119-249-180.dsl.teksavvy.com (HELO pastel.home) ([75.119.249.180]) by ironport2-out.pppoe.ca with ESMTP; 23 Oct 2009 21:05:10 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 389948225; Fri, 23 Oct 2009 21:05:05 -0400 (EDT) In-Reply-To: <83ws2lg44u.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 24 Oct 2009 00:02:57 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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:116345 Archived-At: >>>>> "Eli" == Eli Zaretskii writes: >> From: Andreas Schwab >> Date: Fri, 23 Oct 2009 22:57:07 +0200 >> Cc: emacs-devel@gnu.org >> >> > #define FIXNUM_OVERFLOW_P(i) \ >> > ((EMACS_INT)(i) > MOST_POSITIVE_FIXNUM \ >> > || (EMACS_INT) (i) < MOST_NEGATIVE_FIXNUM) >> > >> > I think FIXNUM_OVERFLOW_P is problematic. >> >> Thanks for the report. The right fix is to remove the cast, so that the >> compiler will promote the operands to the appropriate common type. > I think removing the cast will cause the compiler to whine on 64-bit > platforms about comparison being always right or wrong when the > argument is narrower than a 64-bit long. IIRC, that's why the cast > was introduced in the first place. Actually, when the cast was added in 2001, it came with the following commit-log-comment: (FIXNUM_OVERFLOW_P): Cast I to EMACS_INT in comparisons in case I is of some unsigned type, in which case MOST_NEGATIVE_FIXNUM will be converted to unsigned, and the comparison becomes bogus. -- Stefan