GNU bug report logs - #17475
24.3.91; bug of byte-optimize-zerop

Previous Next

Package: emacs;

Reported by: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>

Date: Mon, 12 May 2014 15:12:02 UTC

Severity: minor

Found in version 24.3.91

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

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 17475 in the body.
You can then email your comments to 17475 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#17475; Package emacs. (Mon, 12 May 2014 15:12:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Shigeru Fukaya <shigeru.fukaya <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 12 May 2014 15:12:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.91; bug of byte-optimize-zerop
Date: Tue, 13 May 2014 00:11:11 +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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17475; Package emacs. (Fri, 16 May 2014 21:13:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: 24.3.91; bug of byte-optimize-zerop
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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17475; Package emacs. (Tue, 20 May 2014 18:34:02 GMT) Full text and rfc822 format available.

Message #11 received at 17475 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>
Cc: 17475 <at> debbugs.gnu.org
Subject: Re: bug#17475: 24.3.91; bug of byte-optimize-zerop
Date: Tue, 20 May 2014 14:32:49 -0400
> 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))))

Actually, you can drop the first option since the optimizer rules for
`=' will take care of it for us.


        Stefan




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Wed, 28 May 2014 00:52:02 GMT) Full text and rfc822 format available.

Notification sent to Shigeru Fukaya <shigeru.fukaya <at> gmail.com>:
bug acknowledged by developer. (Wed, 28 May 2014 00:52:03 GMT) Full text and rfc822 format available.

Message #16 received at 17475-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>
Cc: 17475-done <at> debbugs.gnu.org
Subject: Re: bug#17475: 24.3.91; bug of byte-optimize-zerop
Date: Tue, 27 May 2014 20:51:40 -0400
> (defun byte-optimize-zerop (form)
>   (cond ((numberp (nth 1 form))
>          (eval form))
> 	((list '= (nth 1 form) 0))))

I simplified as suggested and turned it into a compiler-macro.
Thank you for paying attention to details.


        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 25 Jun 2014 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 356 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.