mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-03 14:10:47 -08:00
Make input constraints into memoization hash immutable (bug#45376)
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1) (comp-cstr-intersection): Copy input before soting it into the memoization hash table.
This commit is contained in:
parent
2a22fa8b68
commit
fd8dd75a71
3 changed files with 20 additions and 2 deletions
|
|
@ -507,7 +507,7 @@ DST is returned."
|
|||
(comp-cstr-ctxt-union-1-mem-no-range comp-ctxt)))
|
||||
(res (or (gethash srcs mem-h)
|
||||
(puthash
|
||||
srcs
|
||||
(mapcar #'comp-cstr-copy srcs)
|
||||
(apply #'comp-cstr-union-1-no-mem range srcs)
|
||||
mem-h))))
|
||||
(setf (typeset dst) (typeset res)
|
||||
|
|
@ -676,7 +676,7 @@ DST is returned."
|
|||
(let* ((mem-h (comp-cstr-ctxt-intersection-mem comp-ctxt))
|
||||
(res (or (gethash srcs mem-h)
|
||||
(puthash
|
||||
srcs
|
||||
(mapcar #'comp-cstr-copy srcs)
|
||||
(apply #'comp-cstr-intersection-no-mem srcs)
|
||||
mem-h))))
|
||||
(setf (typeset dst) (typeset res)
|
||||
|
|
|
|||
|
|
@ -417,6 +417,20 @@
|
|||
(setq args (cons (substring arg start pos) args))))
|
||||
args))
|
||||
|
||||
(defun comp-test-45376-f ()
|
||||
;; Reduced from `eshell-ls-find-column-lengths'.
|
||||
(let* (res
|
||||
(len 2)
|
||||
(i 0)
|
||||
(j 0))
|
||||
(while (< j len)
|
||||
(if (= i len)
|
||||
(setq i 0))
|
||||
(setq res (cons i res)
|
||||
j (1+ j)
|
||||
i (1+ i)))
|
||||
res))
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;
|
||||
;; Tromey's tests ;;
|
||||
|
|
|
|||
|
|
@ -409,6 +409,10 @@ https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
|
|||
"Broken call args assumptions lead to infinite loop."
|
||||
(should (equal (comp-test-assume-in-loop-1-f "cd") '("cd"))))
|
||||
|
||||
(comp-deftest bug-45376 ()
|
||||
"<https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-12/msg01883.html>"
|
||||
(should (equal (comp-test-45376-f) '(1 0))))
|
||||
|
||||
(defvar comp-test-primitive-advice)
|
||||
(comp-deftest primitive-advice ()
|
||||
"Test effectiveness of primitive advicing."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue