Hi,
KANEMATSU Daiji <kanematu(a)sra.co.jp> reported in xemacs-beta-ja that
there is a bug in the byte-compiled math function under XEmacs 21.2
as follows:
>>>> In <x2t8zlzlx9p.fsf(a)ext294.sra.co.jp>
>>>> KANEMATSU Daiji <kanematu(a)sra.co.jp> wrote:
(defun my-test1 (num)
(- 0 num))
(my-test1 10);; not compiled
=> -10
(byte-compile 'my-test1)
(my-test1 10);; compiled
=> 10
I found the cause of this in the function `byte-optimize-minus'.
Here is a patch for it.
2001-03-21 Katsumi Yamaoka <yamaoka(a)jpl.org>
* byte-optimize.el (byte-optimize-minus): Fix.
--- byte-optimize.el~ Mon Jan 15 22:05:01 2001
+++ byte-optimize.el Wed Mar 21 09:09:02 2001
@@ -729,8 +729,12 @@
(decf (nth 1 form) last)
(butlast form))
+ ;; (- 0 x) --> (- x)
+ ((and (eq 0 (nth 1 form)) (= (length form) 3))
+ `(- ,(nth 2 form)))
+
;; (- 0 x ...) --> (- (- x) ...)
- ((and (eq 0 (nth 1 form)) (>= (length form) 3))
+ ((and (eq 0 (nth 1 form)) (> (length form) 3))
`(- (- ,(nth 2 form)) ,@(nthcdr 3 form)))
(t (byte-optimize-predicate form)))))
--
Katsumi Yamaoka <yamaoka(a)jpl.org>