diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 38f5dcc993..c44cf71674 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1752,12 +1752,21 @@ byte-optimize-lapcode (setcdr tmp2 lap1) (setq tmp3 (cdr (memq tmp2 tmp3)))) (setq lap (delq lap0 lap) - keep-going t)) + keep-going t) + ;; replace references to tag in jump tables, if any + (dolist (table byte-compile-jump-tables) + (catch 'break + (maphash #'(lambda (value tag) + (when (equal tag lap0) + (puthash value lap1 table) + (throw 'break nil))) + table)))) ;; ;; unused-TAG: --> ;; ((and (eq 'TAG (car lap0)) (not (rassq lap0 lap)) + ;; make sure this tag isn't used in a jump-table (cl-loop for table in byte-compile-jump-tables when (member lap0 (hash-table-values table)) return nil finally return t))