GNU bug report logs - #15326
24.3; Incorrect "variable not left unused" in destructuring cl-loop

Previous Next

Package: emacs;

Reported by: Christopher Wellons <wellons <at> nullprogram.com>

Date: Tue, 10 Sep 2013 18:27:01 UTC

Severity: minor

Found in version 24.3

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 15326 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Wellons <wellons <at> nullprogram.com>
To: 15326 <at> debbugs.gnu.org
Subject: Re: bug#15326: 24.3;
 Incorrect "variable not left unused" in destructuring cl-loop
Date: Wed, 11 Sep 2013 00:47:54 -0400
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:
> A `setq' does not *use* a variable.  It just sets it, affecting
> later uses.

I mean that the compiler counts the setq as a use even in this simple
expression:

    (let (_)
      (setq _ t))
    ;; Warning: variable `_' not left unused

> If there's no later uses, the setq is just a no-op.

Without bothering to dig into the bytecode for it, it seems that the
compiler is still emitting code for the setq:

    (defun foo ()
      (let (_)
        (setq _ t)))

    (defun bar ()
      (let (_)))

    (equal (byte-compile 'foo)
           (byte-compile 'bar))
    ;; => nil

Maybe I'm not understanding what you mean by "no-op" here.




This bug report was last modified 11 years and 241 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.