GNU bug report logs -
#5728
Byte compile doesn't work right on macro
Previous Next
Reported by: Tom Breton <tehom <at> panix.com>
Date: Tue, 16 Mar 2010 02:37:01 UTC
Severity: normal
Done: Chong Yidong <cyd <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> When I byte-compile certain code, the results are different than when
> it's not byte-compiled. It seems to wrongly merge lists. The one
> unusual thing I was doing with the code is using a macro to generate a
> call to a ctor (as generated by defstruct)
You're victim of a form of "name capture".
E.g. if you rename `a' to `b' in BUG3, the bug disappears.
And if you macroexpand by hand the call to BUG:make-form the bug is
still there.
More to the point, the bug is in the compiler-macro for
BUG:make-structure:
ELISP> (compiler-macroexpand '(BUG:make-structure :edits (cons (car a) (BUG:structure->edits cand)) :a nil))
(block BUG:make-structure
(vector 'cl-struct-BUG:structure
(cons (car nil) (BUG:structure->edits cand))
nil))
ELISP> (defsubst* toto (a1 a2) (+ a1 a2))
toto
ELISP> (compiler-macroexpand '(toto a2 nil))
(block toto (+ nil nil))
ELISP>
The problem is that cl-defsubst-expand does the substitution "a1 -> a2
and a2 -> nil" one after the other rather than simultaneously.
I've just installed a fix for it in the emacs-23 branch.
Stefan
This bug report was last modified 13 years and 105 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.