GNU bug report logs -
#3647
23.1.50; defun* generates incorrect code for handling arglist keyword lookup
Previous Next
Reported by: Miles Bader <miles <at> gnu.org>
Date: Mon, 22 Jun 2009 06:50:04 UTC
Severity: normal
Tags: confirmed
Done: Daniel Colascione <dancol <at> dancol.org>
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 3647 in the body.
You can then email your comments to 3647 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#3647
; Package
emacs
.
(Mon, 22 Jun 2009 06:50:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Miles Bader <miles <at> gnu.org>
:
New bug report received and forwarded. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Mon, 22 Jun 2009 06:50:04 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:
Given the following code:
(require 'cl)
(defun* oink (&key a b) (list a b))
then evaluating:
(oink :b :a :a 42)
=> (:a :a)
... which is incorrect. The correct answer is (42 :A).
Looking at the macro-expansion of the above defun* form, the reason is
obvious: the generated code uses (car (cdr (memq KEYWORD ARGLIST))) to
look up keyword argument values, which is obviously bogus if a preceding
argument value is the same as a keyword. It would be more correct to
use (plist-get ARGUMENT KEYWORD), and that's what common-lisp systems I
tested return for this test.
However, the code in cl.el that generates keyword handling code is so
confusing, I'm not really sure how to fix this; presumably something in
`cl-do-arglist'?
Thanks,
-Miles
If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
`bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/local/share/emacs/23.1.50/etc/DEBUG for instructions.
In GNU Emacs 23.1.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.16.2)
of 2009-06-22 on dhlpc061
Windowing system distributor `The X.Org Foundation', version 11.0.10601901
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: ja_JP.UTF-8
value of $XMODIFIERS: @im=SCIM
locale-coding-system: utf-8-unix
default-enable-multibyte-characters: t
Major mode: Lisp Interaction
Minor modes in effect:
shell-dirtrack-mode: t
diff-auto-refine-mode: t
show-paren-mode: t
recentf-mode: t
rcirc-track-minor-mode: t
minibuffer-electric-default-mode: t
display-time-mode: t
desktop-save-mode: t
tooltip-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
global-auto-composition-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
temp-buffer-resize-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
C-p C-n C-u C-p C-u C-p n i n n n n n n n n n n n n
n n SPC n n n n n c y M-v C-u C-u C-p C-u C-p C-u C-p
C-u C-p C-u C-p C-u C-p C-n C-n C-n C-n C-n C-n C-n
= C-e C-a C-x C-v C-g C-g C-g C-x C-v $ % <backspace>
e <backspace> l s e / m a s t e r / l i s p / e m a
c s - l <tab> i <tab> e m <tab> <backspace> <backspace>
c l - m a <tab> <return> C-s C-s m e C-a C-s m e m
q C-s C-s C-s C-s C-s C-s C-s C-a C-s k e y w o C-s
C-a C-s m e m q C-s C-s C-s C-s C-s C-s C-M-u C-M-u
C-M-u C-M-a C-s ( c d r SPC ( C-s C-s C-s C-s C-s C-s
C-s C-s C-s C-s C-a C-s k e y w o r d C-s C-s C-s C-s
C-s C-x 2 C-x b * s c SPC <return> ( <escape> > <return>
( r e q u i r e SPC ' c l ) C-j C-y <backspace> C-a
C-M-f C-a M-f * C-e C-j <help-echo> <down-mouse-2>
<mouse-2> C-p C-e C-j C-x n C-a C-z C-z C-z C-z C-z
C-z C-z C-z C-z C-z C-z C-z C-z C-z C-z C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-e C-b C-b C-b C-b C-a
C-s ' e <backspace> m e m C-a C-v C-s C-s C-s C-s C-s
C-s C-s C-s C-s C-s C-s C-s C-a C-s l o o k C-s C-s
C-a C-x 1 C-x b <return> <escape> x r e p o r t - e
m SPC <return>
Recent messages:
Quit
x*DING* [2 times]
Mark saved where search started [3 times]
Mark set
x*DING*
Mark saved where search started [2 times]
Mark set [3 times]
Mark saved where search started
x*DING*
Mark saved where search started [2 times]
--
Pray, v. To ask that the laws of the universe be annulled in behalf of a
single petitioner confessedly unworthy.
Added tag(s) confirmed.
Request was from
Lars Magne Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sat, 17 Sep 2011 06:28:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#3647
; Package
emacs
.
(Sat, 17 Sep 2011 06:43:06 GMT)
Full text and
rfc822 format available.
Message #10 received at 3647 <at> debbugs.gnu.org (full text, mbox):
Miles Bader <miles.bader <at> necel.com> writes:
> Please describe exactly what actions triggered the bug
> and the precise symptoms of the bug:
>
> Given the following code:
>
> (require 'cl)
> (defun* oink (&key a b) (list a b))
>
> then evaluating:
>
> (oink :b :a :a 42)
> => (:a :a)
>
> ... which is incorrect. The correct answer is (42 :A).
I can confirm that this bug is still present in Emacs 24.
> Looking at the macro-expansion of the above defun* form, the reason is
> obvious: the generated code uses (car (cdr (memq KEYWORD ARGLIST))) to
> look up keyword argument values, which is obviously bogus if a preceding
> argument value is the same as a keyword. It would be more correct to
> use (plist-get ARGUMENT KEYWORD), and that's what common-lisp systems I
> tested return for this test.
>
> However, the code in cl.el that generates keyword handling code is so
> confusing, I'm not really sure how to fix this; presumably something in
> `cl-do-arglist'?
Hm. I think that function could do with some well-placed comments. :-)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
Reply sent
to
Daniel Colascione <dancol <at> dancol.org>
:
You have taken responsibility.
(Sun, 23 Mar 2014 06:21:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Miles Bader <miles <at> gnu.org>
:
bug acknowledged by developer.
(Sun, 23 Mar 2014 06:21:03 GMT)
Full text and
rfc822 format available.
Message #15 received at 3647-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Done
[signature.asc (application/pgp-signature, attachment)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 20 Apr 2014 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 11 years and 121 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.