GNU bug report logs -
#21983
emacs-25: cconv-convert makes invalid transformations on `setq' forms.
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Sun, 22 Nov 2015 18:09:01 UTC
Severity: normal
Done: Alan Mackenzie <acm <at> muc.de>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21983 in the body.
You can then email your comments to 21983 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21983
; Package
emacs
.
(Sun, 22 Nov 2015 18:09:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Alan Mackenzie <acm <at> muc.de>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 22 Nov 2015 18:09:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello, Emacs.
It is desirable for the byte compiler to detect `setq' forms with an odd
number of arguments.
However, when lexical binding is enabled, this is prevented by
cconv-convert. This converts a `setq' form into several single `setq's,
and crucially, takes the liberty of supplying a nil argument to the last
`setq' should no argument have been present. This is a bug.
Here's a patch which appears to fix the problem:
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index efa9a3d..4a3c273 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -477,17 +477,19 @@ cconv-convert
(while forms
(let* ((sym (pop forms))
(sym-new (or (cdr (assq sym env)) sym))
- (value (cconv-convert (pop forms) env extend)))
+ (value-in-list
+ (and forms
+ (list (cconv-convert (pop forms) env extend)))))
(push (pcase sym-new
- ((pred symbolp) `(setq ,sym-new ,value))
- (`(car-safe ,iexp) `(setcar ,iexp ,value))
+ ((pred symbolp) `(setq ,sym-new ,@value-in-list))
+ (`(car-safe ,iexp) `(setcar ,iexp ,@value-in-list))
;; 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))
+ (car value-in-list)))
prognlist)))
(if (cdr prognlist)
`(progn . ,(nreverse prognlist))
Because cconv-convert is written in pcase rather than elisp, I may have
slipped up on some subtlety. Would somebody please check I haven't.
Thanks!
--
Alan Mackenzie (Nuremberg, Germany).
Reply sent
to
Alan Mackenzie <acm <at> muc.de>
:
You have taken responsibility.
(Mon, 23 Nov 2015 14:14:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Alan Mackenzie <acm <at> muc.de>
:
bug acknowledged by developer.
(Mon, 23 Nov 2015 14:14:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 21983-done <at> debbugs.gnu.org (full text, mbox):
Fixed in emacs-25 branch.
--
Alan Mackenzie (Nuremberg, Germany).
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 22 Dec 2015 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 years and 184 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.