* bug#3647: 23.1.50; defun* generates incorrect code for handling arglist keyword lookup
@ 2009-06-22 6:45 Miles Bader
2011-09-17 6:19 ` Lars Magne Ingebrigtsen
2014-03-23 6:20 ` bug#3647: Done Daniel Colascione
0 siblings, 2 replies; 3+ messages in thread
From: Miles Bader @ 2009-06-22 6:45 UTC (permalink / raw)
To: emacs-pretest-bug
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#3647: 23.1.50; defun* generates incorrect code for handling arglist keyword lookup
2009-06-22 6:45 bug#3647: 23.1.50; defun* generates incorrect code for handling arglist keyword lookup Miles Bader
@ 2011-09-17 6:19 ` Lars Magne Ingebrigtsen
2014-03-23 6:20 ` bug#3647: Done Daniel Colascione
1 sibling, 0 replies; 3+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-09-17 6:19 UTC (permalink / raw)
To: Miles Bader; +Cc: 3647
Miles Bader <miles.bader@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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#3647: Done
2009-06-22 6:45 bug#3647: 23.1.50; defun* generates incorrect code for handling arglist keyword lookup Miles Bader
2011-09-17 6:19 ` Lars Magne Ingebrigtsen
@ 2014-03-23 6:20 ` Daniel Colascione
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Colascione @ 2014-03-23 6:20 UTC (permalink / raw)
To: 3647-done
[-- Attachment #1: Type: text/plain, Size: 8 bytes --]
Done
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-23 6:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-22 6:45 bug#3647: 23.1.50; defun* generates incorrect code for handling arglist keyword lookup Miles Bader
2011-09-17 6:19 ` Lars Magne Ingebrigtsen
2014-03-23 6:20 ` bug#3647: Done Daniel Colascione
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).