From fd8dd75a71eef796ba8fb1d2604fd615bebaae42 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Wed, 23 Dec 2020 10:46:33 +0100 Subject: 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. --- test/src/comp-test-funcs.el | 14 ++++++++++++++ test/src/comp-tests.el | 4 ++++ 2 files changed, 18 insertions(+) (limited to 'test/src') diff --git a/test/src/comp-test-funcs.el b/test/src/comp-test-funcs.el index a2663eaf9cf..d6bcfca2d94 100644 --- a/test/src/comp-test-funcs.el +++ b/test/src/comp-test-funcs.el @@ -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 ;; diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 0594a4e086c..5f2d702fca0 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -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 () + "" + (should (equal (comp-test-45376-f) '(1 0)))) + (defvar comp-test-primitive-advice) (comp-deftest primitive-advice () "Test effectiveness of primitive advicing." -- cgit v1.2.1