From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Floating-point constant folding in Emacs byte compiler Date: Mon, 26 Mar 2018 19:02:54 +0300 Message-ID: <838taeg6z5.fsf@gnu.org> References: <2ce39e5c-cd1b-65d6-b125-719caad67932@cs.ucla.edu> <83vadmgfbz.fsf@gnu.org> <87d0zr2n1u.fsf@gmail.com> <83h8p2g99p.fsf@gnu.org> <87370m3k4y.fsf@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1522080334 10868 195.159.176.226 (26 Mar 2018 16:05:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 26 Mar 2018 16:05:34 +0000 (UTC) Cc: emacs-devel@gnu.org To: Robert Pluim Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 26 18:05:29 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f0Ucg-0002f7-5C for ged-emacs-devel@m.gmane.org; Mon, 26 Mar 2018 18:05:26 +0200 Original-Received: from localhost ([::1]:57718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0Uej-00062c-He for ged-emacs-devel@m.gmane.org; Mon, 26 Mar 2018 12:07:33 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0Ua9-0002YV-Nz for emacs-devel@gnu.org; Mon, 26 Mar 2018 12:02:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0Ua6-0000Nm-JL for emacs-devel@gnu.org; Mon, 26 Mar 2018 12:02:49 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:46778) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0Ua6-0000Ni-Fj; Mon, 26 Mar 2018 12:02:46 -0400 Original-Received: from [176.228.60.248] (port=2953 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1f0Ua5-00027B-MQ; Mon, 26 Mar 2018 12:02:46 -0400 In-reply-to: <87370m3k4y.fsf@gmail.com> (message from Robert Pluim on Mon, 26 Mar 2018 17:57:01 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:224044 Archived-At: > From: Robert Pluim > Cc: emacs-devel@gnu.org > Date: Mon, 26 Mar 2018 17:57:01 +0200 > > >> >> I imagine that on a 32-bit version of emacs, (byte-compile (lambda (x) > >> >> (* #x10000 #x10000))) similarly produces a constant-zero function, > >> > > >> > The result depends on whether Emacs was build --with-wide-int. If it > >> > was, the result is #[(x) "\300\207" [4294967296] 1], if it wasn't, I > >> > get #[(x) "\300\207" [0] 1]. > >> > >> Hmm, would it be worthwhile to have Emacs signal overflow in such a > >> situation (perhaps controlled by a configuration variable) so we could > >> fix such issues? > > > > In which of these two cases do you see overflow? > > > > Does (* #x10000 #x10000) not overflow on 32-bit? Only if Emacs was not built --with-wide-int. > > I also don't think I understand the utility of signaling an overflow > > error from the byte compiler that happened because it did constant > > folding. What else except bug reports could this yield? > > I was proposing it as a debug option, not a generally enabled one. Of > course if there's no overflow, it would be kind of useless :-) If we want the byte code to be portable, the results of compiling cannot depend on the machine on which the code was byte-compiled.