From unknown Mon Aug 18 06:57:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17681: 24.3.91; "Arithmetic Error" in hide-ifdef mode when using shift operators Resent-From: David Engster Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 Jun 2014 19:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 17681 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 17681@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.140182279329973 (code B ref -1); Tue, 03 Jun 2014 19:14:02 +0000 Received: (at submit) by debbugs.gnu.org; 3 Jun 2014 19:13:13 +0000 Received: from localhost ([127.0.0.1]:42612 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wru92-0007nN-O5 for submit@debbugs.gnu.org; Tue, 03 Jun 2014 15:13:13 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53832) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wru8z-0007mv-P3 for submit@debbugs.gnu.org; Tue, 03 Jun 2014 15:13:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wru8n-0006ow-PO for submit@debbugs.gnu.org; Tue, 03 Jun 2014 15:13:04 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:36119) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wru8n-0006os-Ma for submit@debbugs.gnu.org; Tue, 03 Jun 2014 15:12:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wru8h-0005aH-KL for bug-gnu-emacs@gnu.org; Tue, 03 Jun 2014 15:12:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wru8b-0006my-HW for bug-gnu-emacs@gnu.org; Tue, 03 Jun 2014 15:12:51 -0400 Received: from randomsample.de ([5.45.97.173]:54648) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wru8b-0006lZ-8B for bug-gnu-emacs@gnu.org; Tue, 03 Jun 2014 15:12:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=randomsample.de; s=a; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=2taozh2pmn14WA5n/Ag6TeCyobYu60ao9hWmaPFF8k0=; b=jlDxnQi/pdZY62e5ezwVn8JFqFCCFRF3lG8ChtQrJFp5VHygbgyfJ0kuiTPvn52wkNBny27s7/pJl+Z2/IGgeBWUUu00yyFdByjRgOrjbNHJyAayzyShshsD7YlX0oQF; Received: from dslc-082-083-039-000.pools.arcor-ip.net ([82.83.39.0] helo=spaten) by randomsample.de with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1Wru8U-0002wx-85 for bug-gnu-emacs@gnu.org; Tue, 03 Jun 2014 21:12:38 +0200 From: David Engster Date: Tue, 03 Jun 2014 21:12:33 +0200 Message-ID: <87zjhtn6xq.fsf@engster.org> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.9 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Recipe: - Create a file "test.h" containing the following (this is from the file 'jiffies.h' in the Linux kernel): #if !((((NSEC_PER_SEC << 2) / TICK_NSEC) << (SEC_JIFFIE_SC - 2)) & 0x80000000) #endif - emacs -Q - Load the file, activate hide-ifdef-mode - C-c @ h (hide-ifdefs) The minibuffer will show "Arithmetic Error". Here is the backtrace: Debugger entered--Lisp error: (arith-error) hif-divide(0 nil) (hif-shiftleft (hif-divide (hif-shiftleft (hif-lookup (quote NSEC_PER_SEC)) 2) (hif-lookup (quote TICK_NSEC))) (hif-minus (hif-lookup (quote SEC_JIFFIE_SC)) 2)) (hif-logand (hif-shiftleft (hif-divide (hif-shiftleft (hif-lookup (quote NSEC_PER_SEC)) 2) (hif-lookup (quote TICK_NSEC))) (hif-minus (hif-lookup (quote SEC_JIFFIE_SC)) 2)) 2147483648.0) (hif-not (hif-logand (hif-shiftleft (hif-divide (hif-shiftleft (hif-lookup (quote NSEC_PER_SEC)) 2) (hif-lookup (quote TICK_NSEC))) (hif-minus (hif-lookup (quote SEC_JIFFIE_SC)) 2)) 2147483648.0)) eval((hif-not (hif-logand (hif-shiftleft (hif-divide (hif-shiftleft (hif-lookup (quote NSEC_PER_SEC)) 2) (hif-lookup (quote TICK_NSEC))) (hif-minus (hif-lookup (quote SEC_JIFFIE_SC)) 2)) 2147483648.0))) hif-possibly-hide() hide-ifdef-guts() hide-ifdefs() Earlier Emacsen did not throw an error here (although it is very possible that the above line wasn't calculated correctly). Still, this probably qualifies as a regression. -David From unknown Mon Aug 18 06:57:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17681: 24.3.91; "Arithmetic Error" in hide-ifdef mode when using shift operators Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Jun 2014 22:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17681 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: luke.yx.lee@gmail.com Cc: 17681@debbugs.gnu.org, David Engster Received: via spool by 17681-submit@debbugs.gnu.org id=B17681.140200717931085 (code B ref 17681); Thu, 05 Jun 2014 22:27:02 +0000 Received: (at 17681) by debbugs.gnu.org; 5 Jun 2014 22:26:19 +0000 Received: from localhost ([127.0.0.1]:46221 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wsg71-00085I-4O for submit@debbugs.gnu.org; Thu, 05 Jun 2014 18:26:19 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:36317 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wsg6y-000858-Gc for 17681@debbugs.gnu.org; Thu, 05 Jun 2014 18:26:17 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1Wsg6x-0006AJ-BR; Thu, 05 Jun 2014 18:26:15 -0400 From: Glenn Morris References: <87zjhtn6xq.fsf@engster.org> X-Spook: Aladdin Mossad electronic surveillance Venezuela Verisign X-Ran: (yj##[>ya2v?0B)SR<-XVY.];No@,3eE5T~RAJ`>v0Zg2y`0"8qWua*Slg3.J=I!3L$8&Q X-Hue: magenta X-Attribution: GM Date: Thu, 05 Jun 2014 18:26:15 -0400 In-Reply-To: <87zjhtn6xq.fsf@engster.org> (David Engster's message of "Tue, 03 Jun 2014 21:12:33 +0200") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.7 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.7 (-----) Luke, could you take a look at this report please? http://debbugs.gnu.org/17681 An artificial but smaller example might be: #if 1 / FOO #endif David Engster wrote: > Recipe: > > - Create a file "test.h" containing the following (this is from > the file 'jiffies.h' in the Linux kernel): > > #if !((((NSEC_PER_SEC << 2) / TICK_NSEC) << (SEC_JIFFIE_SC - 2)) & 0x80000000) > #endif > > - emacs -Q > > - Load the file, activate hide-ifdef-mode > > - C-c @ h (hide-ifdefs) > > The minibuffer will show "Arithmetic Error". Here is the backtrace: > > Debugger entered--Lisp error: (arith-error) > hif-divide(0 nil) > (hif-shiftleft (hif-divide (hif-shiftleft (hif-lookup (quote NSEC_PER_SEC)) 2) (hif-lookup (quote TICK_NSEC))) (hif-minus (hif-lookup (quote SEC_JIFFIE_SC)) 2)) > (hif-logand (hif-shiftleft (hif-divide (hif-shiftleft (hif-lookup (quote NSEC_PER_SEC)) 2) (hif-lookup (quote TICK_NSEC))) (hif-minus (hif-lookup (quote SEC_JIFFIE_SC)) 2)) 2147483648.0) > (hif-not (hif-logand (hif-shiftleft (hif-divide (hif-shiftleft (hif-lookup (quote NSEC_PER_SEC)) 2) (hif-lookup (quote TICK_NSEC))) (hif-minus (hif-lookup (quote SEC_JIFFIE_SC)) 2)) 2147483648.0)) > eval((hif-not (hif-logand (hif-shiftleft (hif-divide (hif-shiftleft (hif-lookup (quote NSEC_PER_SEC)) 2) (hif-lookup (quote TICK_NSEC))) (hif-minus (hif-lookup (quote SEC_JIFFIE_SC)) 2)) 2147483648.0))) > hif-possibly-hide() > hide-ifdef-guts() > hide-ifdefs() > > Earlier Emacsen did not throw an error here (although it is very > possible that the above line wasn't calculated correctly). Still, this > probably qualifies as a regression. From unknown Mon Aug 18 06:57:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17681: 24.3.91; "Arithmetic Error" in hide-ifdef mode when using shift operators Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 06 Jun 2014 01:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17681 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Glenn Morris Cc: 17681@debbugs.gnu.org, luke.yx.lee@gmail.com, David Engster Received: via spool by 17681-submit@debbugs.gnu.org id=B17681.140201668419516 (code B ref 17681); Fri, 06 Jun 2014 01:05:01 +0000 Received: (at 17681) by debbugs.gnu.org; 6 Jun 2014 01:04:44 +0000 Received: from localhost ([127.0.0.1]:46291 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WsiaJ-00054f-7U for submit@debbugs.gnu.org; Thu, 05 Jun 2014 21:04:43 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:40514) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WsiaG-00054K-T3 for 17681@debbugs.gnu.org; Thu, 05 Jun 2014 21:04:41 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkgRAIDvNVPO+IOj/2dsb2JhbABZgwYYI4MPwD2BFxd0giUBAQEBAgFWIwULCw4mEhQYDSSIBAjSGReOegeEOASaAYs7g12BaoFxgVsh X-IPAS-Result: AkgRAIDvNVPO+IOj/2dsb2JhbABZgwYYI4MPwD2BFxd0giUBAQEBAgFWIwULCw4mEhQYDSSIBAjSGReOegeEOASaAYs7g12BaoFxgVsh X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="65991776" Received: from 206-248-131-163.dsl.teksavvy.com (HELO pastel.home) ([206.248.131.163]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 05 Jun 2014 21:04:34 -0400 Received: by pastel.home (Postfix, from userid 20848) id 7310660705; Thu, 5 Jun 2014 21:04:34 -0400 (EDT) From: Stefan Monnier Message-ID: References: <87zjhtn6xq.fsf@engster.org> Date: Thu, 05 Jun 2014 21:04:34 -0400 In-Reply-To: (Glenn Morris's message of "Thu, 05 Jun 2014 18:26:15 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > Luke, could you take a look at this report please? > http://debbugs.gnu.org/17681 > An artificial but smaller example might be: > #if 1 / FOO > #endif I think he already sent me a patch fixing this problem (which IIUC is a problem I introduced, BTW). Stefan From unknown Mon Aug 18 06:57:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17681: 24.3.91; "Arithmetic Error" in hide-ifdef mode when using shift operators Resent-From: Luke Lee Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 06 Jun 2014 06:10:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17681 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: Glenn Morris , 17681@debbugs.gnu.org, David Engster Received: via spool by 17681-submit@debbugs.gnu.org id=B17681.140203495831923 (code B ref 17681); Fri, 06 Jun 2014 06:10:03 +0000 Received: (at 17681) by debbugs.gnu.org; 6 Jun 2014 06:09:18 +0000 Received: from localhost ([127.0.0.1]:46400 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WsnL2-0008Io-CV for submit@debbugs.gnu.org; Fri, 06 Jun 2014 02:09:17 -0400 Received: from mail-pb0-f54.google.com ([209.85.160.54]:46611) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WsnD8-00081w-B8 for 17681@debbugs.gnu.org; Fri, 06 Jun 2014 02:01:08 -0400 Received: by mail-pb0-f54.google.com with SMTP id jt11so2194580pbb.41 for <17681@debbugs.gnu.org>; Thu, 05 Jun 2014 23:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=eKQAoRdP0YQY2y5WayxaUG4Zxd13NFwza4/l6PbUsEQ=; b=rutA+K/BysFejIZHN5WDs4uJxTgIkzIIVV+rXKuwTXW1I3bFZKBF3xzpxr/qf5+3Ad oreZSoSrzBW9NzmEBb1PAwkpqql33kdFLmRXROfCE139Q/OaPZmJSJwbURw3UwHiy4KH wP8OaiYgeKPh8cn+fn+eE6wdReOGDvr9ZH3pQXmVloYq5mQjWLtI6jDNAuNZHftmxxBf S76a8tDM4ydhICBHteAkN5tEY6IlAoSrzTTUokAS2eNWe+0nyLT80z2lRzj3RK+39sP4 25Yaqpvxx40LXWorbUmRwrFH+c/y/x9o/rsnePjBwswDtP+VjxgJQMyBJ/bco/SC2NVQ 8v5Q== X-Received: by 10.68.222.196 with SMTP id qo4mr5332111pbc.14.1402034459537; Thu, 05 Jun 2014 23:00:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.70.89.228 with HTTP; Thu, 5 Jun 2014 23:00:19 -0700 (PDT) In-Reply-To: References: <87zjhtn6xq.fsf@engster.org> From: Luke Lee Date: Fri, 6 Jun 2014 14:00:19 +0800 Message-ID: Content-Type: multipart/alternative; boundary=047d7b2ede71ec77eb04fb249528 X-Spam-Score: -0.7 (/) X-Mailman-Approved-At: Fri, 06 Jun 2014 02:09:15 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --047d7b2ede71ec77eb04fb249528 Content-Type: text/plain; charset=UTF-8 >I think he already sent me a patch fixing this problem Yes, I think my new patch fixed that problem. However, if you're trying to hide jiffies.h it will eventually failed at some other place due to the "unsigned long" integer postfix (i.e. the "UL" in 100000UL), which hideif still consider it a "TODO". #define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ) 2014-06-06 9:04 GMT+08:00 Stefan Monnier : > > Luke, could you take a look at this report please? > > > http://debbugs.gnu.org/17681 > > > An artificial but smaller example might be: > > > #if 1 / FOO > > #endif > > I think he already sent me a patch fixing this problem (which IIUC is > a problem I introduced, BTW). > > > Stefan > -- Best regards, Luke Lee --047d7b2ede71ec77eb04fb249528 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
>I think he already sent me a patch fixing th= is problem

Yes, I think my new patch fixed that problem. However, if= you're trying to hide
jiffies.h it will eventually failed at = some other place due to the "unsigned long"
integer postfix (i.e. the "UL" in 100000UL), which hideif still c= onsider it a "TODO".

#define TICK_USEC ((1000000UL + USER_= HZ/2) / USER_HZ)



2014-06-06 9:04 GMT+08:00 Stefan Monnier <monnier@iro.umontreal.ca<= /a>>:
> Luke, could you take a look at this report please?

>
http://debb= ugs.gnu.org/17681

> An artificial but smaller example might be:

> #if 1 / FOO
> #endif

I think he already sent me a patch fixing this problem (which IIUC is=
a problem I introduced, BTW).


=C2=A0 =C2=A0 =C2=A0 =C2=A0 Stefan



--
Best rega= rds,
Luke Lee

--047d7b2ede71ec77eb04fb249528-- From unknown Mon Aug 18 06:57:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17681: 24.3.91; "Arithmetic Error" in hide-ifdef mode when using shift operators In-Reply-To: <87zjhtn6xq.fsf@engster.org> Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 06 Jun 2014 07:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17681 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Luke Lee Cc: 17681@debbugs.gnu.org, Stefan Monnier , David Engster Received: via spool by 17681-submit@debbugs.gnu.org id=B17681.140203903413922 (code B ref 17681); Fri, 06 Jun 2014 07:18:02 +0000 Received: (at 17681) by debbugs.gnu.org; 6 Jun 2014 07:17:14 +0000 Received: from localhost ([127.0.0.1]:46453 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WsoOn-0003cQ-Ra for submit@debbugs.gnu.org; Fri, 06 Jun 2014 03:17:14 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:43567 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WsoOl-0003cE-Jt for 17681@debbugs.gnu.org; Fri, 06 Jun 2014 03:17:12 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1WsoOk-0003nI-4D; Fri, 06 Jun 2014 03:17:10 -0400 From: Glenn Morris References: <87zjhtn6xq.fsf@engster.org> X-Spook: Etacs Hugo Chavez Juiliett Class Submarine Guantanamo X-Ran: hNq~QIOXQM-?SoS5mubX'0v5_tn)(7>u1kb)E@"e7MnHNQ-w51*aSkW6.s:szUmE4zol_w X-Hue: blue X-Attribution: GM Date: Fri, 06 Jun 2014 03:17:09 -0400 Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.7 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.7 (-----) Luke Lee wrote: >>I think he already sent me a patch fixing this problem > > Yes, I think my new patch fixed that problem. Is this patch posted anywhere? > However, if you're trying to hide jiffies.h it will eventually failed > at some other place due to the "unsigned long" integer postfix (i.e. > the "UL" in 100000UL), which hideif still consider it a "TODO". > > #define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ) When you say fail, do you mean it will give an error? If so, why not ignore-errors around these evaluations? From unknown Mon Aug 18 06:57:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17681: 24.3.91; "Arithmetic Error" in hide-ifdef mode when using shift operators Resent-From: Luke Lee Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 06 Jun 2014 11:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17681 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Glenn Morris Cc: 17681@debbugs.gnu.org, Stefan Monnier , David Engster Received: via spool by 17681-submit@debbugs.gnu.org id=B17681.140205311716702 (code B ref 17681); Fri, 06 Jun 2014 11:12:02 +0000 Received: (at 17681) by debbugs.gnu.org; 6 Jun 2014 11:11:57 +0000 Received: from localhost ([127.0.0.1]:46587 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wss3w-0004LJ-IL for submit@debbugs.gnu.org; Fri, 06 Jun 2014 07:11:57 -0400 Received: from mail-ie0-f175.google.com ([209.85.223.175]:45527) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wss3u-0004L1-Ba for 17681@debbugs.gnu.org; Fri, 06 Jun 2014 07:11:55 -0400 Received: by mail-ie0-f175.google.com with SMTP id tp5so665405ieb.20 for <17681@debbugs.gnu.org>; Fri, 06 Jun 2014 04:11:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=iP0dG3eLhCH6dijoUchuL0FT204msn5huN9izpArnj8=; b=slgF/9KzUQYlnUMWUqdIeX4jYnPknz7rUdl+E8keyHmq1YWBV6l2VyPrdJDucfPASu iBEqnUta+asm/iQbwt0H46p37N4yHazByKI+yPZMNbrQLoK0IeUkkHu7rcBeFroDjJYw AIPqFNyI3JTAGXkDaoJ/gu/QKryFmMvOZLwnm0By+zUF6Vavzxr474s16ojCvRLRuoGT 4alIhSt8goJESm4W/3xteCUl9VduIbOKRCEiOkwvkdl5Ce9mCPgXSzy/ymD6rvj+awES cKp55InE2wk9IiDbx/znnMt5qRVAjNgPcpnPOHSGgmpZhJjfIUW88L2WUHQfdITblgU2 VScA== X-Received: by 10.42.27.147 with SMTP id j19mr4833842icc.81.1402053108508; Fri, 06 Jun 2014 04:11:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.70.89.228 with HTTP; Fri, 6 Jun 2014 04:11:08 -0700 (PDT) In-Reply-To: References: <87zjhtn6xq.fsf@engster.org> From: Luke Lee Date: Fri, 6 Jun 2014 19:11:08 +0800 Message-ID: Content-Type: multipart/alternative; boundary=20cf304352ce7d2d4104fb28edc2 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --20cf304352ce7d2d4104fb28edc2 Content-Type: text/plain; charset=UTF-8 >Is this patch posted anywhere? I only send it to Stefan for review since it's a set of patches that forms the complete work of http://www.emacswiki.org/emacs/hideif.el. Patch set #1 has already been submitted into Emacs trunk while patch set #2 is still under Stefan's reviewing. Patchset #3 to come. All 3 patches forms the hideif.el posted on EmacsWiki. You can try this version. >When you say fail, do you mean it will give an error? >If so, why not ignore-errors around these evaluations? Different versions of Emacs seems to behave differently. On my Linux machine it's Emacs 24.3.50.2 and it does not throw any error. On Cygwin Emacs 24.3.2 it throw an error. It seems that others' submitted `hif-string-to-number' introduced some difference. On Cygwin's Emacs version the `split-string' function used in `hif-string-to-number' take no more than 3 arguments but it takes 4 arguments in my Linux Emacs 24.3.50.2. After fixing this they still behave differently. I'm focusing on Linux version so I did not investigate what makes the difference. Due to the internal behavior of hideif sometimes it's not so easy to just ignore some errors then continue. There are still some cases that hideif will throw an error. To prevent hideif from throwing any errors, it's actually another TODO item. I'll first complete the reviewing of the remaining patch set. 2014-06-06 15:17 GMT+08:00 Glenn Morris : > Luke Lee wrote: > > >>I think he already sent me a patch fixing this problem > > > > Yes, I think my new patch fixed that problem. > > Is this patch posted anywhere? > > > However, if you're trying to hide jiffies.h it will eventually failed > > at some other place due to the "unsigned long" integer postfix (i.e. > > the "UL" in 100000UL), which hideif still consider it a "TODO". > > > > #define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ) > > When you say fail, do you mean it will give an error? > If so, why not ignore-errors around these evaluations? > -- Best regards, Luke Lee --20cf304352ce7d2d4104fb28edc2 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
>Is this patch posted anywhere?

<= /div>I only send it to Stefan for review since it's a set of patches that forms the complete work of

http://www.emacswiki.org/emacs/hideif.el.

Patch set #1 has already been submitted into Emacs trunk
while= patch set #2 is still under Stefan's reviewing. Patchset
#3 to come. All 3 patches forms the hideif.el posted on
EmacsWiki. You can try this version.

>When you say fai= l, do you mean it will give an error?
>If so, why not ignore-errors a= round these evaluations?

Different versions of Emacs seem= s to behave=C2=A0
differently. On my Linux machine it's Emacs 24.3.50.2
and it does n= ot throw any error. On Cygwin Emacs
24.3.2 it throw an error. It seems = that others' submitted
`hif-string-to-number' introdu= ced some difference.

On Cygwin's Emacs version the `split-string' function
used = in `hif-string-to-number' take no more than 3
arguments but it takes= 4 arguments in my Linux
Emacs 24.3.50.2. After fixing this = they still behave
differently. I'm focusing on Linux version so I did
not investigate what makes the difference.

Due to = the internal behavior of hideif sometimes it's
not so ea= sy to just ignore some errors then continue.
There are still some cases that hideif will throw an
error. = To prevent hideif from throwing any errors, it's
actually another T= ODO item. I'll first complete the
reviewing of the remaining patch s= et.



2014-06-06 15:17 GMT+08:00 Glenn Morris= <rgm= @gnu.org>:
Luke Lee wrote:

>>I think he already sent me a patch fixing this problem
>
> Yes, I think my new patch fixed that problem.

Is this patch posted anywhere?

> However, if you're trying to hide jiffies.h it will eventually fai= led
> at some other place due to the "unsigned long" integer postf= ix (i.e.
> the "UL" in 100000UL), which hideif still consider it a &quo= t;TODO".
>
> #define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)

When you say fail, do you mean it will give an error?
If so, why not ignore-errors around these evaluations?



--
Best regards,
Luke = Lee

--20cf304352ce7d2d4104fb28edc2-- From unknown Mon Aug 18 06:57:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17681: 24.3.91; "Arithmetic Error" in hide-ifdef mode when using shift operators Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 06 Jun 2014 15:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17681 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Luke Lee Cc: 17681@debbugs.gnu.org, Stefan Monnier , David Engster Received: via spool by 17681-submit@debbugs.gnu.org id=B17681.140206800222394 (code B ref 17681); Fri, 06 Jun 2014 15:21:02 +0000 Received: (at 17681) by debbugs.gnu.org; 6 Jun 2014 15:20:02 +0000 Received: from localhost ([127.0.0.1]:47389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wsvw1-0005ou-8B for submit@debbugs.gnu.org; Fri, 06 Jun 2014 11:20:01 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:34777 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wsvvy-0005oi-K6 for 17681@debbugs.gnu.org; Fri, 06 Jun 2014 11:19:59 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1Wsvvv-0006z7-Pl; Fri, 06 Jun 2014 11:19:56 -0400 From: Glenn Morris References: <87zjhtn6xq.fsf@engster.org> X-Spook: clandestine digicash Adriatic defense information warfare X-Ran: 24E;^|]gGI{;e`e**4]D.eDrHKpSZ'S9M-yHqr["$H4K//aAs;|vq'PRTGuVEh.6Vo6DQV X-Hue: magenta X-Attribution: GM Date: Fri, 06 Jun 2014 11:19:54 -0400 In-Reply-To: (Luke Lee's message of "Fri, 6 Jun 2014 19:11:08 +0800") Message-ID: <7wsinirrol.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.7 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.7 (-----) Luke Lee wrote: > Different versions of Emacs seems to behave differently. On my Linux > machine it's Emacs 24.3.50.2 and it does not throw any error. On > Cygwin Emacs 24.3.2 it throw an error. The relevant version at the moment is the Emacs 24.3.91 pretest. http://alpha.gnu.org/gnu/emacs/pretest/emacs-24.3.91.tar.xz 24.3.50 is an old development version and should not be used any more. > It seems that others' submitted `hif-string-to-number' introduced some > difference. Apart from your 2014-01-28 changes, I see no changes to hideif.el in Emacs 24.3.91 since 2012-10-02. hif-string-to-number is only in the Emacs trunk, not the emacs-24 branch, so doesn't affect this report. From unknown Mon Aug 18 06:57:48 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: David Engster Subject: bug#17681: closed (Re: bug#17681: 24.3.91; "Arithmetic Error" in hide-ifdef mode when using shift operators) Message-ID: References: <87zjhtn6xq.fsf@engster.org> X-Gnu-PR-Message: they-closed 17681 X-Gnu-PR-Package: emacs Reply-To: 17681@debbugs.gnu.org Date: Sun, 26 Jun 2016 04:54:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1466916842-10234-1" This is a multi-part message in MIME format... ------------=_1466916842-10234-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #17681: 24.3.91; "Arithmetic Error" in hide-ifdef mode when using shift ope= rators which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 17681@debbugs.gnu.org. --=20 17681: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D17681 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1466916842-10234-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 17681-done) by debbugs.gnu.org; 26 Jun 2016 04:53:46 +0000 Received: from localhost ([127.0.0.1]:55952 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bH24o-0002ee-FL for submit@debbugs.gnu.org; Sun, 26 Jun 2016 00:53:46 -0400 Received: from mail-oi0-f45.google.com ([209.85.218.45]:32958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bH24n-0002eR-3U for 17681-done@debbugs.gnu.org; Sun, 26 Jun 2016 00:53:45 -0400 Received: by mail-oi0-f45.google.com with SMTP id u201so163535644oie.0 for <17681-done@debbugs.gnu.org>; Sat, 25 Jun 2016 21:53:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:message-id:subject:to; bh=jiTtUvo4ydumcZGQHMxrNTUGNlrUbpZGG/xdeyLKMPY=; b=hJXPt0iGRVGTTN/m4Vbb04WbsOQHccPe94c9h85MYnYGzBEZKX01PFukMF8PcguUC5 l/jH5qZk7VveQmnDm0jDBgEdfqixFn2YkAc7ZNW6AkIRd5SQ3xzK2qNTUb1TjbXw1dVg XnTMYvi/pM5rYJtLLUt/k1C4oY6DkReNCRVw1xT9YdI4c/Vtl3hyNR6eyrjS5L4o5JDX 6VoFCF7cRtONwPtnSYOVxwV7s+FFpaEMdOxzf8cCVR8o/Xv+c1Q9hJ3Z8x8R/X0H8pP8 +IrgnumG+X1PyCXF/HCPGAxsFEenFmM9LG6YoS4DNsy8IBfy/IcC/ThISzYMW0bCiZhM +mqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=jiTtUvo4ydumcZGQHMxrNTUGNlrUbpZGG/xdeyLKMPY=; b=YO0rGrEH/cN4mODlbSMg3PK0co4tnfsuOD4NIbP+fTTexFzOZIPmJNaXqn1F9LYTQN 5dgFYrNipK/PN+13q2XDiqoqP6PznMqAZgdF7AmeWRSbXFWblTg/1gD7kVrAOTEoEt84 5wfitAIFD6w2Pq1wLY8GqH3YKbonpiVgoW7wJDpdWAIPfIiBwD2a2bi4WuDVv+v7f28k pxgz5QSa43n++TqzJRAbMHlzjdA5/I2ZJuNwmd/J/L4e4xXLGm1zKfq1F/DaJpbdKKSR 5skIqdZoqX74+QDeYCJ32oykHu+d3LLf9mLHyStQsGQSXh8rgmVRclnSSGmpyw/J/2mu AVrA== X-Gm-Message-State: ALyK8tK5PiSpQ5RyUvc0g0KQSpAabH1YDrf8HdOOvn+uUCaxNW23LjPrfl1/rd0zBJ8Qr082cdom1IodSGj+NA== X-Received: by 10.157.17.113 with SMTP id p46mr7992419otp.196.1466916819564; Sat, 25 Jun 2016 21:53:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.52.238 with HTTP; Sat, 25 Jun 2016 21:53:39 -0700 (PDT) From: Noam Postavsky Date: Sun, 26 Jun 2016 00:53:39 -0400 X-Google-Sender-Auth: APClQbRhJ5h3LcWcscG71efDBj8 Message-ID: Subject: Re: bug#17681: 24.3.91; "Arithmetic Error" in hide-ifdef mode when using shift operators To: 17681-done@debbugs.gnu.org Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 17681-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Version: 25.0.95 I see the problem in Emacs 24.5, but not Emacs 25.0.95, so it seems to have been fixed sometime in between. ------------=_1466916842-10234-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 3 Jun 2014 19:13:13 +0000 Received: from localhost ([127.0.0.1]:42612 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wru92-0007nN-O5 for submit@debbugs.gnu.org; Tue, 03 Jun 2014 15:13:13 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53832) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wru8z-0007mv-P3 for submit@debbugs.gnu.org; Tue, 03 Jun 2014 15:13:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wru8n-0006ow-PO for submit@debbugs.gnu.org; Tue, 03 Jun 2014 15:13:04 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:36119) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wru8n-0006os-Ma for submit@debbugs.gnu.org; Tue, 03 Jun 2014 15:12:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wru8h-0005aH-KL for bug-gnu-emacs@gnu.org; Tue, 03 Jun 2014 15:12:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wru8b-0006my-HW for bug-gnu-emacs@gnu.org; Tue, 03 Jun 2014 15:12:51 -0400 Received: from randomsample.de ([5.45.97.173]:54648) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wru8b-0006lZ-8B for bug-gnu-emacs@gnu.org; Tue, 03 Jun 2014 15:12:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=randomsample.de; s=a; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=2taozh2pmn14WA5n/Ag6TeCyobYu60ao9hWmaPFF8k0=; b=jlDxnQi/pdZY62e5ezwVn8JFqFCCFRF3lG8ChtQrJFp5VHygbgyfJ0kuiTPvn52wkNBny27s7/pJl+Z2/IGgeBWUUu00yyFdByjRgOrjbNHJyAayzyShshsD7YlX0oQF; Received: from dslc-082-083-039-000.pools.arcor-ip.net ([82.83.39.0] helo=spaten) by randomsample.de with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1Wru8U-0002wx-85 for bug-gnu-emacs@gnu.org; Tue, 03 Jun 2014 21:12:38 +0200 From: David Engster To: bug-gnu-emacs@gnu.org Subject: 24.3.91; "Arithmetic Error" in hide-ifdef mode when using shift operators Date: Tue, 03 Jun 2014 21:12:33 +0200 Message-ID: <87zjhtn6xq.fsf@engster.org> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.9 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Recipe: - Create a file "test.h" containing the following (this is from the file 'jiffies.h' in the Linux kernel): #if !((((NSEC_PER_SEC << 2) / TICK_NSEC) << (SEC_JIFFIE_SC - 2)) & 0x80000000) #endif - emacs -Q - Load the file, activate hide-ifdef-mode - C-c @ h (hide-ifdefs) The minibuffer will show "Arithmetic Error". Here is the backtrace: Debugger entered--Lisp error: (arith-error) hif-divide(0 nil) (hif-shiftleft (hif-divide (hif-shiftleft (hif-lookup (quote NSEC_PER_SEC)) 2) (hif-lookup (quote TICK_NSEC))) (hif-minus (hif-lookup (quote SEC_JIFFIE_SC)) 2)) (hif-logand (hif-shiftleft (hif-divide (hif-shiftleft (hif-lookup (quote NSEC_PER_SEC)) 2) (hif-lookup (quote TICK_NSEC))) (hif-minus (hif-lookup (quote SEC_JIFFIE_SC)) 2)) 2147483648.0) (hif-not (hif-logand (hif-shiftleft (hif-divide (hif-shiftleft (hif-lookup (quote NSEC_PER_SEC)) 2) (hif-lookup (quote TICK_NSEC))) (hif-minus (hif-lookup (quote SEC_JIFFIE_SC)) 2)) 2147483648.0)) eval((hif-not (hif-logand (hif-shiftleft (hif-divide (hif-shiftleft (hif-lookup (quote NSEC_PER_SEC)) 2) (hif-lookup (quote TICK_NSEC))) (hif-minus (hif-lookup (quote SEC_JIFFIE_SC)) 2)) 2147483648.0))) hif-possibly-hide() hide-ifdef-guts() hide-ifdefs() Earlier Emacsen did not throw an error here (although it is very possible that the above line wasn't calculated correctly). Still, this probably qualifies as a regression. -David ------------=_1466916842-10234-1--