summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/emacs-lisp/comp.el4
-rw-r--r--test/src/comp-tests.el9
2 files changed, 10 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 1808e727bb9..15b8b3ab8da 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -1153,9 +1153,7 @@ Return value is the fall through block name."
SP-DELTA is the stack adjustment."
(let ((subr (symbol-function subr-name))
(nargs (1+ (- sp-delta))))
- (unless (subrp subr)
- (signal 'native-ice (list "not a subr" subr)))
- (let* ((arity (subr-arity subr))
+ (let* ((arity (func-arity subr))
(minarg (car arity))
(maxarg (cdr arity)))
(when (eq maxarg 'unevalled)
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index ae96e5d3868..446a61549d9 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -430,6 +430,15 @@ https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
;; Bug#42664, Bug#43280, Bug#44209.
(should-not (subr-native-elisp-p (symbol-function #'comp-test-defsubst-f))))
+(comp-deftest primitive-redefine-compile-44221 ()
+ "Test the compiler still works while primitives are redefined (bug#44221)."
+ (cl-letf (((symbol-function #'delete-region)
+ (lambda (_ _))))
+ (should (subr-native-elisp-p
+ (native-compile
+ '(lambda ()
+ (delete-region (point-min) (point-max))))))))
+
;;;;;;;;;;;;;;;;;;;;;
;; Tromey's tests. ;;