From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#46834: 28.0.50; byte-compiling the standard counter closure fails Date: Mon, 01 Mar 2021 14:16:39 +0100 Message-ID: <8735xf8154.fsf@gnus.org> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36318"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 46834@debbugs.gnu.org, Stefan Monnier To: Pip Cet Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 01 14:17:10 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lGiQA-0009K4-Nu for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Mar 2021 14:17:10 +0100 Original-Received: from localhost ([::1]:48340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lGiQ9-0002t6-Dk for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Mar 2021 08:17:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lGiQ1-0002ss-Vy for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2021 08:17:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36928) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lGiQ1-0001w5-P9 for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2021 08:17:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lGiQ1-0000s4-Kl for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2021 08:17:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Mar 2021 13:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46834 X-GNU-PR-Package: emacs Original-Received: via spool by 46834-submit@debbugs.gnu.org id=B46834.16146046153035 (code B ref 46834); Mon, 01 Mar 2021 13:17:01 +0000 Original-Received: (at 46834) by debbugs.gnu.org; 1 Mar 2021 13:16:55 +0000 Original-Received: from localhost ([127.0.0.1]:48474 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lGiPv-0000mh-3A for submit@debbugs.gnu.org; Mon, 01 Mar 2021 08:16:55 -0500 Original-Received: from quimby.gnus.org ([95.216.78.240]:42338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lGiPt-0000gj-EL for 46834@debbugs.gnu.org; Mon, 01 Mar 2021 08:16:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=PXId3FeNttJQ8gHP6k01MRQiuNsFAGBL4BaTPeDAssg=; b=kF9fxGa9LuX7/VFUNKl9AU9BV8 v94rTFwikzQrk4wufdTNT49RMUqfZ15dsuA20gFOh13JoSwm5uhtVMALlwOLXnqTIvRawW0u5St8a RRA8rqQDpOVJOjTgzVjqKrU4R61n/UdKND0N2fJ9SMMcZJjiW73Uht1J4439MTSCpiho=; Original-Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lGiPh-00027W-Al; Mon, 01 Mar 2021 14:16:46 +0100 X-Now-Playing: Big Thief's _Two Hands_: "Cut My Hair" In-Reply-To: (Pip Cet's message of "Sun, 28 Feb 2021 19:57:59 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:201088 Archived-At: Pip Cet writes: >> Steps to reproduce from emacs -Q: >> Evaluate the following in a lexically-bound Emacs Lisp buffer: >> >> (byte-compile (let ((l 0)) (lambda () (cl-incf l)))) >> >> Expected result: >> >> A byte code object which will increment its return value by one every >> time it is called. >> >> Actual result: >> >> A byte code object which always returns 1. Huh, that's such a standard example of using closures that it's surprising that we haven't tripped on this before... but I guess we don't really write code like that much in Emacs. (I can confirm that the test case doesn't work in Emacs 28.) > Patch attached. I've looked through the generated bytecode for all of > lisp/ and there appear to be no significant differences. I've added Stefan M to the CCs; perhaps he has some comments. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no