unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>, Lars Ingebrigtsen <larsi@gnus.org>
Cc: michael_heerdegen@web.de, Gemini Lasswell <gazally@runbox.com>,
	46573@debbugs.gnu.org
Subject: bug#46573: 28.0.50; Error when edebugging setting unbound place
Date: Mon, 01 Mar 2021 16:17:40 -0500	[thread overview]
Message-ID: <jwvlfb6oael.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83r1le7lwg.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 17 Feb 2021 17:29:35 +0200")

>> I checked older Emacs versions -- (setf foo 'bar) works in Emacs 26.1,
>> but not in Emacs 27.1.
> Then we should try fixing it in Emacs 27.2, if that's possible without
> risky changes.

I plan to install the patch below into `master` to fix this problem, but
I believe this change is sufficiently safe for the `emacs-27` branch, so
you agree I'll install it into `emacs-27` instead.

For code like

    (setf (car x) (cdr x))

The instrumented in Emacs-27.1 looked like:

    (let* ((v (edebug-after 0 2 x)))
      (progn
        (edebug-after (edebug-before 1) 3 (car v))
        (setcar v (edebug-after (edebug-before 4) 6
                                (cdr (edebug-after 0 5 x))))))

with the new code it will look like:

    (let* ((v (edebug-after 0 2 x)))
      (edebug-after
       (edebug-before 1) 3
       (setcar v (edebug-after (edebug-before 4) 6
                               (cdr (edebug-after 0 5 x))))))

For reference in Emacs-26, it looked like:

    (let* ((v (edebug-after 0 2 x)))
      (setcar v (edebug-after (edebug-before 4) 6
                              (cdr (edebug-after 0 5 x)))))

IIUC Gemini is too busy with real life to look at this now, but my
understanding of the motivation for his change was that the Emacs-26
code left instrumentation points 1 and 3 above completely unused (they
are generated by Edebug and then thrown away by macro expansion), giving
the mistaken impression (to the code-coverage checker) that these
execution paths are not exercised.  The new form should preserve the
benefit of Gemini's change in this respect while improving the behavior
during Edebug.


        Stefan


* lisp/emacs-lisp/gv.el (edebug-after): Don't run getter in the setter

This fixes bug#46573 which was introduced by commit
d79cf638f278e50c22feb53d6ba556f5ce9d7853.
The new code is a middle ground, which makes sure the instrumentation
point is used (so the coverage checker won't have ghost unreachable
instrumentation points) yet without artificially running the getter
when we only need to run the setter.


diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el
index 3d8054950c..ce48e578e0 100644
--- a/lisp/emacs-lisp/gv.el
+++ b/lisp/emacs-lisp/gv.el
@@ -324,8 +324,7 @@ 'gv-place
        (gv-letplace (getter setter) place
          (funcall do `(edebug-after ,before ,index ,getter)
                   (lambda (store)
-                    `(progn (edebug-after ,before ,index ,getter)
-                            ,(funcall setter store)))))))
+                    `(edebug-after ,before ,index ,(funcall setter store)))))))
 
 ;;; The common generalized variables.
 






  reply	other threads:[~2021-03-01 21:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 22:32 bug#46573: 28.0.50; Error when edebugging setting unbound place Michael Heerdegen
2021-02-16 22:51 ` Lars Ingebrigtsen
2021-02-16 23:04   ` Stefan Monnier
2021-02-16 23:09     ` Lars Ingebrigtsen
2021-02-16 23:19       ` Lars Ingebrigtsen
2021-02-16 23:21         ` Lars Ingebrigtsen
2021-02-17 15:29           ` Eli Zaretskii
2021-03-01 21:17             ` Stefan Monnier [this message]
2021-03-02  5:58               ` Eli Zaretskii
2021-03-05 17:39                 ` Stefan Monnier
2021-03-03 23:13               ` Michael Heerdegen
2021-03-03 23:26                 ` Stefan Monnier
2021-03-03 23:47                   ` Michael Heerdegen
2021-02-17  0:00       ` Stefan Monnier
2021-02-24  0:59         ` Gemini Lasswell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvlfb6oael.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=46573@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=gazally@runbox.com \
    --cc=larsi@gnus.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).