diff options
author | Andrea Corallo <akrl@sdf.org> | 2020-12-19 11:56:15 +0100 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2020-12-21 20:22:03 +0100 |
commit | 5376563517f2235b8b79f661c213fd74dd62b654 (patch) | |
tree | c0a7f9d7f40eb586b47fa1f2056acab6ea8d0ef6 /lisp/emacs-lisp | |
parent | 6f3570cd4a615caa02c3d86320049a5631ab9b25 (diff) | |
download | emacs-5376563517f2235b8b79f661c213fd74dd62b654.tar.gz emacs-5376563517f2235b8b79f661c213fd74dd62b654.tar.bz2 emacs-5376563517f2235b8b79f661c213fd74dd62b654.zip |
Fix `comp-add-call-cstr' and add a test
* lisp/emacs-lisp/comp.el (comp-add-call-cstr): Fix it.
* test/src/comp-tests.el (assume-in-loop-1): New test.
* test/src/comp-test-funcs.el (comp-test-assume-in-loop-1-f): New
function.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/comp.el | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 895e1ac33e4..5345e20bfc0 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -2017,21 +2017,24 @@ TARGET-BB-SYM is the symbol name of the target block." (pcase insn (`(set ,lhs (,(pred comp-call-op-p) ,f . ,args)) (when-let ((cstr-f (gethash f comp-known-func-cstr-h))) - (cl-values cstr-f lhs args))) + (cl-values f cstr-f lhs args))) (`(,(pred comp-call-op-p) ,f . ,args) (when-let ((cstr-f (gethash f comp-known-func-cstr-h))) - (cl-values cstr-f nil args)))))) - (cl-multiple-value-bind (cstr-f lhs args) match + (cl-values f cstr-f nil args)))))) + (cl-multiple-value-bind (f cstr-f lhs args) match (cl-loop + with gen = (comp-lambda-list-gen (comp-cstr-f-args cstr-f)) for arg in args - for gen = (comp-lambda-list-gen (comp-cstr-f-args cstr-f)) for cstr = (funcall gen) for target = (comp-cond-cstrs-target-mvar arg insn bb) + unless (comp-cstr-p cstr) + do (signal 'native-ice + (list "Incoherent type specifier for function" f)) when (and target (or (null lhs) (not (eql (comp-mvar-slot lhs) (comp-mvar-slot target))))) - do (comp-emit-call-cstr target insn-cell cstr))))))) + do (comp-emit-call-cstr target insn-cell cstr))))))) (defun comp-add-cstrs (_) "Rewrite conditional branches adding appropriate 'assume' insns. |