GNU bug report logs - #30872
incorrect byte-compile of closure called from local funcalled function

Previous Next

Package: emacs;

Reported by: Aaron Jensen <aaronjensen <at> gmail.com>

Date: Tue, 20 Mar 2018 03:10:01 UTC

Severity: normal

Tags: confirmed, fixed, patch

Found in versions 24.3, 26.0.91

Fixed in version 27.1

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Aaron Jensen <aaronjensen <at> gmail.com>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 30872 <at> debbugs.gnu.org
Subject: Re: bug#30872: incorrect byte-compile of closure called from local
 funcalled function
Date: Wed, 30 May 2018 18:55:33 -0400
I narrowed it down a bit more, note the lack of setq in the result of
byte-compile-preprocess:

(byte-compile-preprocess
 '#'(lambda (handle-fun arg)
      (let* ((subfun #'(lambda (params)
                         (ignore handle-fun)
                         (funcall #'(lambda () (setq params nil)))
                         params)))
        (funcall subfun arg))))
;=>
#'(lambda (handle-fun arg)
    (let* ((subfun
            #'(lambda (handle-fun params)
                (ignore handle-fun)
                (funcall
                 (internal-make-closure nil
                                        (params)
                                        nil nil))
                params)))
      (funcall subfun handle-fun arg)))

It's hitting this bit of code in cconv.el, where it says this "should
never happen":

(defun cconv-convert (form env extend)
  (pcase form
    [...]
    (`(setq . ,forms)                   ; setq special form
      [...]
             (push (pcase sym-new
                     ((pred symbolp) `(setq ,sym-new ,value))
                     (`(car-safe ,iexp) `(setcar ,iexp ,value))
                     ;; This "should never happen", but for variables which are
                     ;; mutated+captured+unused, we may end up trying to `setq'
                     ;; on a closed-over variable, so just drop the setq.
                     (_ ;; (byte-compile-report-error
                      ;;  (format "Internal error in cconv of (setq %s ..)"
                      ;;          sym-new))
                      value))

Stefan, thoughts?




This bug report was last modified 6 years and 338 days ago.

Previous Next


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