GNU bug report logs - #12813
gv-define-simple-setter can evaluate VAL more than once

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Tue, 6 Nov 2012 07:51:02 UTC

Severity: normal

Found in version 24.2.50

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 12813 in the body.
You can then email your comments to 12813 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#12813; Package emacs. (Tue, 06 Nov 2012 07:51:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: submit <at> debbugs.gnu.org
Subject: gv-define-simple-setter can evaluate VAL more than once
Date: Tue, 06 Nov 2012 02:47:25 -0500
Package: emacs
Version: 24.2.50

I don't know if you will consider this a bug.
gv-define-simple-setter with FIX-RETURN non-nil evaluates VAL twice.
This may lead to unintended behaviour.

Artificial example in `emacs -Q':

(defun foo (x)
  (car x))

(defun foo-set (x y)
  (setcar x y))

(gv-define-simple-setter foo foo-set t)

(setq bar '(1 2 3))
(setq i 0)

(setf (foo bar) (setq i (1+ i)))   ; -> 1
bar                                ; -> (2 2 3) rather than (1 2 3)


defsetf in 24.2 was documented to not have this issue
(info "(cl)Customizing Setf")
[...]

(let ((temp VALUE))
  (UPDATE-FN ARG1 ARG2 ARG3 temp)
  temp)

So at the very least this will be relevant if http://debbugs.gnu.org/12812
gets the "obvious" fix.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12813; Package emacs. (Wed, 07 Nov 2012 03:40:03 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 12813 <at> debbugs.gnu.org
Subject: Re: bug#12813: gv-define-simple-setter can evaluate VAL more than once
Date: Tue, 06 Nov 2012 22:39:50 -0500
> I don't know if you will consider this a bug.
> gv-define-simple-setter with FIX-RETURN non-nil evaluates VAL twice.

Thanks, should be fixed now,


        Stefan




bug closed, send any further explanations to 12813 <at> debbugs.gnu.org and Glenn Morris <rgm <at> gnu.org> Request was from Stefan Monnier <monnier <at> iro.umontreal.ca> to control <at> debbugs.gnu.org. (Wed, 07 Nov 2012 03:45:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 05 Dec 2012 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 260 days ago.

Previous Next


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