diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2023-08-04 11:08:57 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2023-08-04 11:08:57 +0200 |
commit | 44d7fd3805f5b1e0b571ece007abc466e1b39ba5 (patch) | |
tree | 2a91d6bf9aa655b893aae0a46ad29accebf4f7b3 /lisp/emacs-lisp | |
parent | c75c7997197502189023c9f47140474fa7fd719e (diff) | |
download | emacs-44d7fd3805f5b1e0b571ece007abc466e1b39ba5.tar.gz emacs-44d7fd3805f5b1e0b571ece007abc466e1b39ba5.tar.bz2 emacs-44d7fd3805f5b1e0b571ece007abc466e1b39ba5.zip |
Don't allow the `eq` and `unbind` byte-ops to commute (bug#65017)
* lisp/emacs-lisp/byte-opt.el (byte-after-unwind-ops):
Cease sinking `eq` past `unwind`, because that optimised away the
let-binding in
(let ((symbols-with-pos-enabled nil))
(eq x y))
and `eq` is currently sensitive to `symbols-with-pos-enabled`.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp--eq-symbols-with-pos-enabled): New test.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/byte-opt.el | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index c7d8531a870..12c2bc51b92 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -2141,7 +2141,7 @@ See Info node `(elisp) Integer Basics'." '(byte-constant byte-dup byte-stack-ref byte-stack-set byte-discard byte-discardN byte-discardN-preserve-tos byte-symbolp byte-consp byte-stringp byte-listp byte-numberp byte-integerp - byte-eq byte-not + byte-not byte-cons byte-list1 byte-list2 byte-list3 byte-list4 byte-listN byte-interactive-p) ;; How about other side-effect-free-ops? Is it safe to move an @@ -2149,6 +2149,11 @@ See Info node `(elisp) Integer Basics'." ;; No, it is not, because the unwind-protect forms can alter ;; the inside of the object to which nth would apply. ;; For the same reason, byte-equal was deleted from this list. + ;; + ;; In particular, `byte-eq' isn't here despite `eq' being nominally + ;; pure because it is currently affected by `symbols-with-pos-enabled' + ;; and so cannot be sunk past an unwind op that might end a binding of + ;; that variable. Yes, this is unsatisfactory. "Byte-codes that can be moved past an unbind.") (defconst byte-compile-side-effect-and-error-free-ops |