GNU bug report logs - #60974
30.0.50; byte-compile-preprocess mutates self evaluating forms in expanded macro bodies

Previous Next

Package: emacs;

Reported by: Vibhav Pant <vibhavp <at> gmail.com>

Date: Fri, 20 Jan 2023 21:25:01 UTC

Severity: normal

Found in version 30.0.50

Full log


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

From: Vibhav Pant <vibhavp <at> gmail.com>
To: 60974 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Cc: emacs-devel <emacs-devel <at> gnu.org>
Subject: Re: [PATCH] 30.0.50; byte-compile-preprocess mutates self
 evaluating forms in expanded macro bodies
Date: Sat, 21 Jan 2023 03:06:34 +0530
[Message part 1 (text/plain, inline)]
The attached patch should fix this, thoughts?

Thanks,
Vibhav

-- 
Vibhav Pant
vibhavp <at> gmail.com
GPG: 7ED1 D48C 513C A024 BE3A  785F E3FB 28CB 6AB5 9598
[60974.patch (text/x-patch, inline)]
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index aa9521e5a65..847965e6af6 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2581,7 +2581,8 @@ byte-compile-flush-pending
 
 (defun byte-compile-preprocess (form &optional _for-effect)
   (let ((print-symbols-bare t))         ; Possibly redundant binding.
-    (setq form (macroexpand-all form byte-compile-macro-environment)))
+    (setq form (copy-tree
+                (macroexpand-all form byte-compile-macro-environment))))
   ;; FIXME: We should run byte-optimize-form here, but it currently does not
   ;; recurse through all the code, so we'd have to fix this first.
   ;; Maybe a good fix would be to merge byte-optimize-form into
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 2 years and 189 days ago.

Previous Next


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