]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix miscompilation of funcall forms in some cases (bug#46974)
authorPip Cet <pipcet@gmail.com>
Sat, 6 Mar 2021 20:53:57 +0000 (20:53 +0000)
committerPip Cet <pipcet@gmail.com>
Sat, 6 Mar 2021 20:53:57 +0000 (20:53 +0000)
* lisp/emacs-lisp/comp.el (comp-call-optim-func): Call
comp-cstr-imm-vld-p before relying on comp-cstr-imm to return the
right value.

lisp/emacs-lisp/comp.el

index 8a6e761fe40ea94933f3152b517c044e0e073103..134b5a28086fe148e55c316f2d3039c9f3b410e0 100644 (file)
@@ -3282,11 +3282,13 @@ FUNCTION can be a function-name or byte compiled function."
    do (comp-loop-insn-in-block b
         (pcase insn
           (`(set ,lval (callref funcall ,f . ,rest))
-           (when-let ((new-form (comp-call-optim-form-call
+           (when-let ((ok (comp-cstr-imm-vld-p f))
+                      (new-form (comp-call-optim-form-call
                                  (comp-cstr-imm f) rest)))
              (setf insn `(set ,lval ,new-form))))
           (`(callref funcall ,f . ,rest)
-           (when-let ((new-form (comp-call-optim-form-call
+           (when-let ((ok (comp-cstr-imm-vld-p f))
+                      (new-form (comp-call-optim-form-call
                                  (comp-cstr-imm f) rest)))
              (setf insn new-form)))))))