Subject: bug#17475: 24.3.91; bug of byte-optimize-zerop

From: Shigeru Fukaya <[email-masked]>
Date: Sat, 17 May 2014 06:11:55 +0900

>`byte-optimize-zerop' is badly implemented.  Even when
>`byte-compile-delete-errors' is non-nil, bute-compiled code may
>signal an error.
>(= FORM 0) and (zerop FORM) are functionally equal, besides, the
>former is better when byte-compiled.
>
>The following is the poor alternative.
>I can't make a smart code without creating a new function.
>
>(defun byte-optimize-zerop (form)
>  (cond ((numberp (nth 1 form))
>         (eval form))
>        (byte-compile-delete-errors
>         `(and (member ,(nth 1 form) (quote 0 0.0))) t)
>        ((list '= (nth 1 form) 0))))
>
>-- Shigeru

zerop itself is not an error-free fuction.
I'll change my poroposal code.

(defun byte-optimize-zerop (form)
  (cond ((numberp (nth 1 form))
         (eval form))
	((list '= (nth 1 form) 0))))

-- Shigeru