From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#12369: 24.2.50; cl-loop: variable not left unused Date: Thu, 06 Sep 2012 11:43:04 -0400 Message-ID: References: <87d31z1ets@ch.ristopher.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1346946248 21475 80.91.229.3 (6 Sep 2012 15:44:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 6 Sep 2012 15:44:08 +0000 (UTC) To: 12369@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 06 17:44:10 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1T9eFV-0007lU-7j for geb-bug-gnu-emacs@m.gmane.org; Thu, 06 Sep 2012 17:44:09 +0200 Original-Received: from localhost ([::1]:41738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9eFS-00069j-5B for geb-bug-gnu-emacs@m.gmane.org; Thu, 06 Sep 2012 11:44:06 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56259) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9eFI-00068e-M7 for bug-gnu-emacs@gnu.org; Thu, 06 Sep 2012 11:44:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9eFC-0004Zt-9T for bug-gnu-emacs@gnu.org; Thu, 06 Sep 2012 11:43:56 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34803) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9eFC-0004Zd-6Y for bug-gnu-emacs@gnu.org; Thu, 06 Sep 2012 11:43:50 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1T9eFO-000804-Fe for bug-gnu-emacs@gnu.org; Thu, 06 Sep 2012 11:44:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 06 Sep 2012 15:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12369 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.134694621830713 (code B ref -1); Thu, 06 Sep 2012 15:44:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Sep 2012 15:43:38 +0000 Original-Received: from localhost ([127.0.0.1]:44349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9eEy-0007zJ-MF for submit@debbugs.gnu.org; Thu, 06 Sep 2012 11:43:37 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45974) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9eEw-0007zC-Ux for submit@debbugs.gnu.org; Thu, 06 Sep 2012 11:43:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9eEe-0004Wt-Pg for submit@debbugs.gnu.org; Thu, 06 Sep 2012 11:43:22 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:51112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9eEe-0004Wp-Mu for submit@debbugs.gnu.org; Thu, 06 Sep 2012 11:43:16 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9eEZ-00061v-VB for bug-gnu-emacs@gnu.org; Thu, 06 Sep 2012 11:43:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9eEU-0004Vs-5b for bug-gnu-emacs@gnu.org; Thu, 06 Sep 2012 11:43:11 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:61262) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9eEU-0004Vo-13 for bug-gnu-emacs@gnu.org; Thu, 06 Sep 2012 11:43:06 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ai0FAG6Zu09FpYew/2dsb2JhbAA7CbBIg0mBCIIVAQEEAVYoCws0EhQYDYhABboJixiCDoMeA6MzgViDBQ X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="197708680" Original-Received: from 69-165-135-176.dsl.teksavvy.com (HELO pastel.home) ([69.165.135.176]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 06 Sep 2012 11:43:04 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 252E158B33; Thu, 6 Sep 2012 11:43:04 -0400 (EDT) In-Reply-To: <87d31z1ets@ch.ristopher.com> (Christopher Schmidt's message of "Thu, 6 Sep 2012 14:06:05 +0100 (BST)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:63856 Archived-At: > ;; -*- lexical-binding: t -*- > (require 'cl-lib) > (cl-loop for (rms . emacs) in nil) > Byte compile this piece of code. > Warning: Unused lexical variable `rms' Yes, first bug: `emacs' is not listed as unused. > Attempting to fix this warning by renaming rms to _rms results in > another warning. > Warning: variable `_rms' not left unused Yup, second bug. This is all due to the code generated by cl-loop which was optimized to use `set' in the loop instead of `let'. This made sense for dynamically scoped code where `let' is a bit slower, but for lexically-scoped code, it's the exact opposite, so we should change the generated code from: (identity (catch '--cl-block-nil-- (let* ((--cl-var-- nil) (emacs nil) (rms nil)) (while (consp --cl-var--) (setq emacs (car --cl-var--) rms (pop emacs)) (setq --cl-var-- (cdr --cl-var--))) nil))) to (identity (catch '--cl-block-nil-- (let* ((--cl-var-- nil)) (while (consp --cl-var--) (let* ((tmp (car --cl-var--)) (emacs (car tmp)) (rms (cdr tmp))) (setq --cl-var-- (cdr --cl-var--)))) nil))) -- Stefan