GNU bug report logs - #46834
28.0.50; byte-compiling the standard counter closure fails

Previous Next

Package: emacs;

Reported by: Pip Cet <pipcet <at> gmail.com>

Date: Sun, 28 Feb 2021 18:08:02 UTC

Severity: normal

Found in version 28.0.50

Done: Pip Cet <pipcet <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


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

From: Pip Cet <pipcet <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 46834 <at> debbugs.gnu.org
Subject: Re: bug#46834: 28.0.50;
 byte-compiling the standard counter closure fails
Date: Mon, 1 Mar 2021 15:01:51 +0000
[Message part 1 (text/plain, inline)]
On Mon, Mar 1, 2021 at 2:23 PM Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:
> > diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
> > index a2fe37a1ee586..7d00b453caf1c 100644
> > --- a/lisp/emacs-lisp/bytecomp.el
> > +++ b/lisp/emacs-lisp/bytecomp.el
> > @@ -2785,16 +2785,12 @@ byte-compile--reify-function
> >      (dolist (binding env)
> >        (cond
> >         ((consp binding)
> > -        ;; We check shadowing by the args, so that the `let' can be moved
> > -        ;; within the lambda, which can then be unfolded.  FIXME: Some of those
> > -        ;; bindings might be unused in `body'.
> > -        (unless (memq (car binding) args) ;Shadowed.
> > -          (push `(,(car binding) ',(cdr binding)) renv)))
> > +        (push `(,(car binding) ',(cdr binding)) renv))
> >         ((eq binding t))
> >         (t (push `(defvar ,binding) body))))
> >      (if (null renv)
> >          `(lambda ,args ,@preamble ,@body)
> > -      `(lambda ,args ,@preamble (let ,(nreverse renv) ,@body)))))
> > +      `(let ,renv (lambda ,args ,@preamble ,@body)))))
>
> This looks good, thanks, but it changes the nature of the output of
> `byte-compile` from a function value to an expression whose evaluation
> returns a function value.  So I think we should tweak `byte-compile` so
> it calls `eval` on the result in this particular case.

Thanks! That's a good catch :-)

Is this what you meant?

Pip
[0001-Compile-closures-that-modify-their-bound-vars-correc.patch (text/x-patch, attachment)]

This bug report was last modified 4 years and 85 days ago.

Previous Next


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