GNU bug report logs -
#33890
27.0.50; Incorrect behaviour of cl-loop macro
Previous Next
Reported by: Quek Yu Han <qythium <at> gmail.com>
Date: Thu, 27 Dec 2018 17:37:01 UTC
Severity: normal
Tags: confirmed, fixed
Merged with 32506
Found in version 27.0.50
Fixed in version 27.0.90
Done: Noam Postavsky <npostavs <at> gmail.com>
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 33890 in the body.
You can then email your comments to 33890 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#33890
; Package
emacs
.
(Thu, 27 Dec 2018 17:37:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Quek Yu Han <qythium <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 27 Dec 2018 17:37:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
It appears that a change to the `cl-loop` macro in Emacs 27 introduced a
bug where certain clauses would be evaluated more than once in a loop
with a "when" clause.
See the following minimal example which finds the index of an element in
a list:
(cl-loop
for x in '(a b c d e)
for index = 0 then (1+ index)
when (eq x 'e)
return index)
In Emacs 26.1 this returns `4` as expected, but in Emacs 27.0.50 it
returns `7`, due to the index being incremented twice per loop. The same
occurs after a `emacs -Q` restart.
For reference here is the macroexpanded form of the above expression,
with the difference between 26 and 27 outlined (everything else is
identical):
(cl-block nil
(let* ((--cl-var-- '(a b c d e))
(x nil)
(index nil)
(--cl-var-- t)
(--cl-var-- t)
--cl-var--)
(while (and (consp --cl-var--)
(progn
(setq x (car --cl-var--))
(setq index
(if --cl-var-- 0 (1+ index)))
(if (eq x 'e)
(setq --cl-var-- index
--cl-var-- nil)
t)))
(setq --cl-var-- (cdr --cl-var--))
;;;============== ADDED IN EMACS 27 =================
(and (and (consp --cl-var--)
(progn
(setq x (car --cl-var--))
(setq index
(if --cl-var-- 0 (1+ index)))
(if (eq x 'e)
(setq --cl-var-- index
--cl-var-- nil)
t))))
;;;==================================================
(setq --cl-var-- nil))
--cl-var--))
Thanks!
In GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin17.6.0, NS
appkit-1561.40 Version 10.13.5 (Build 17F77))
of 2018-07-08 built on QYH.local
Repository revision: 98463bed07ecc9057094928ffdc2321eaaf3ab52
Windowing system distributor 'Apple', version 10.3.1671
System Description: Mac OS X 10.14.2
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Configured using:
'configure --disable-dependency-tracking --disable-silent-rules
--enable-locallisppath=/usr/local/share/emacs/site-lisp
--infodir=/usr/local/Cellar/emacs-plus/HEAD-98463be/share/info/emacs
--prefix=/usr/local/Cellar/emacs-plus/HEAD-98463be --with-xml2
--without-dbus --with-gnutls --with-imagemagick --with-modules
--with-rsvg --with-xwidgets --with-ns --disable-ns-self-contained'
Configured features:
RSVG IMAGEMAGICK NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS
MODULES THREADS XWIDGETS LCMS2
Important settings:
value of $LC_ALL: en_US.UTF-8
value of $LC_CTYPE: UTF-8
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml
easymenu mml-sec password-cache epa derived epg epg-config gnus-util
rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core term/tty-colors frame cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote xwidget-internal kqueue
cocoa ns lcms2 multi-tty make-network-process emacs)
Memory information:
((conses 16 203880 9574)
(symbols 48 20001 1)
(miscs 40 33 114)
(strings 32 28869 1418)
(string-bytes 1 768776)
(vectors 16 35252)
(vector-slots 8 725502 18860)
(floats 8 47 69)
(intervals 56 230 0)
(buffers 992 11))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#33890
; Package
emacs
.
(Mon, 31 Dec 2018 06:23:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 33890 <at> debbugs.gnu.org (full text, mbox):
Quek Yu Han wrote:
> It appears that a change to the `cl-loop` macro in Emacs 27 introduced a
> bug where certain clauses would be evaluated more than once in a loop
> with a "when" clause.
This seems to be another manifestation of https://debbugs.gnu.org/32506
due to a0365437c9ee308ad7978e436631020f513b25e7.
Merged 32506 33890.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Mon, 31 Dec 2018 06:24:02 GMT)
Full text and
rfc822 format available.
Added tag(s) fixed.
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Wed, 29 Apr 2020 18:28:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 27.0.90, send any further explanations to
32506 <at> debbugs.gnu.org and Helmut Eller <eller.helmut <at> gmail.com>
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Wed, 29 Apr 2020 18:28:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 28 May 2020 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 333 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.