From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#46573: 28.0.50; Error when edebugging setting unbound place Date: Mon, 01 Mar 2021 16:17:40 -0500 Message-ID: References: <87v9ar1w4l.fsf@web.de> <87mtw3r5hr.fsf@gnus.org> <8735xvr4o2.fsf@gnus.org> <87y2fnppn5.fsf@gnus.org> <87r1lfppjm.fsf@gnus.org> <83r1le7lwg.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7981"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: michael_heerdegen@web.de, Gemini Lasswell , 46573@debbugs.gnu.org To: Eli Zaretskii , Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 01 22:18:14 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lGpvh-0001xF-BJ for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Mar 2021 22:18:13 +0100 Original-Received: from localhost ([::1]:53458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lGpvg-0007lq-6E for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Mar 2021 16:18:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lGpvW-0007kp-Rz for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2021 16:18:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39488) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lGpvW-0006kN-KA for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2021 16:18:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lGpvW-0000yW-Fj for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2021 16:18:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Mar 2021 21:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46573 X-GNU-PR-Package: emacs Original-Received: via spool by 46573-submit@debbugs.gnu.org id=B46573.16146334713717 (code B ref 46573); Mon, 01 Mar 2021 21:18:02 +0000 Original-Received: (at 46573) by debbugs.gnu.org; 1 Mar 2021 21:17:51 +0000 Original-Received: from localhost ([127.0.0.1]:51032 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lGpvK-0000xt-Pk for submit@debbugs.gnu.org; Mon, 01 Mar 2021 16:17:51 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:7709) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lGpvJ-0000xh-BF for 46573@debbugs.gnu.org; Mon, 01 Mar 2021 16:17:49 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 8D43A441CB2; Mon, 1 Mar 2021 16:17:43 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id D1C86441C98; Mon, 1 Mar 2021 16:17:41 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1614633461; bh=9kib95qo8Tu9wRhTg+UJNNBhD1MN5t8CtdIBVIBx2EA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=VRYsZwR3XI2wqm7HI2E3j3DPnapAqgmVwoJrlrbc0yGUPdQvUS910HIow20BZMInU W8zddo1wT2d+i2Fr3DStGC/djqm6G/QB7QpdhIfUEVgcp8K/ASlHsQJLLDgROBzQRr MQCdRQhPpvxiHpG3lfkiyuvYuk2A/YUNFAl69MLbmg1zebTe847Em5y7+xXWsPqAJN DrShfaaSJ/+p96f2dmoTZoWrPVClDb6VMhfCuTbh7skpAdT14N/mniF6mkbyVGwvkP JnysTuBy0WpdFiwuzOXohlzTXxhwa/WEbe9eBAIumSBoIJwbn3veEY2+udHDu+bqFd LE2Aa/ObkSMSA== Original-Received: from alfajor (unknown [216.154.41.47]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C05FE120327; Mon, 1 Mar 2021 16:17:41 -0500 (EST) In-Reply-To: <83r1le7lwg.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 17 Feb 2021 17:29:35 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:201171 Archived-At: >> 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.