Fix integer arithmetic miss-compilation (bug#53451)
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-set-range-for-arithm): When one of the two sources is negated revert to set dst as number. * test/src/comp-tests.el (comp-tests-type-spec-tests): Add test to verify this is effective.
This commit is contained in:
parent
31af9bca99
commit
69e82968d7
2 changed files with 22 additions and 13 deletions
|
@ -449,18 +449,20 @@ Return them as multiple value."
|
||||||
(declare (debug (range-body))
|
(declare (debug (range-body))
|
||||||
(indent defun))
|
(indent defun))
|
||||||
`(with-comp-cstr-accessors
|
`(with-comp-cstr-accessors
|
||||||
(when-let ((r1 (range ,src1))
|
(if (or (neg src1) (neg src2))
|
||||||
(r2 (range ,src2)))
|
(setf (typeset ,dst) '(number))
|
||||||
(let* ((l1 (comp-cstr-smallest-in-range r1))
|
(when-let ((r1 (range ,src1))
|
||||||
(l2 (comp-cstr-smallest-in-range r2))
|
(r2 (range ,src2)))
|
||||||
(h1 (comp-cstr-greatest-in-range r1))
|
(let* ((l1 (comp-cstr-smallest-in-range r1))
|
||||||
(h2 (comp-cstr-greatest-in-range r2)))
|
(l2 (comp-cstr-smallest-in-range r2))
|
||||||
(setf (typeset ,dst) (when (cl-some (lambda (x)
|
(h1 (comp-cstr-greatest-in-range r1))
|
||||||
(comp-subtype-p 'float x))
|
(h2 (comp-cstr-greatest-in-range r2)))
|
||||||
(append (typeset src1)
|
(setf (typeset ,dst) (when (cl-some (lambda (x)
|
||||||
(typeset src2)))
|
(comp-subtype-p 'float x))
|
||||||
'(float))
|
(append (typeset src1)
|
||||||
(range ,dst) ,@range-body)))))
|
(typeset src2)))
|
||||||
|
'(float))
|
||||||
|
(range ,dst) ,@range-body))))))
|
||||||
|
|
||||||
(defun comp-cstr-add-2 (dst src1 src2)
|
(defun comp-cstr-add-2 (dst src1 src2)
|
||||||
"Sum SRC1 and SRC2 into DST."
|
"Sum SRC1 and SRC2 into DST."
|
||||||
|
|
|
@ -1353,7 +1353,14 @@ Return a list of results."
|
||||||
(when (eql x 1.0)
|
(when (eql x 1.0)
|
||||||
(error ""))
|
(error ""))
|
||||||
x)
|
x)
|
||||||
t)))
|
t)
|
||||||
|
|
||||||
|
;; 74
|
||||||
|
((defun comp-tests-ret-type-spec-f (x)
|
||||||
|
(if (eq x 0)
|
||||||
|
(error "")
|
||||||
|
(1+ x)))
|
||||||
|
number)))
|
||||||
|
|
||||||
(defun comp-tests-define-type-spec-test (number x)
|
(defun comp-tests-define-type-spec-test (number x)
|
||||||
`(comp-deftest ,(intern (format "ret-type-spec-%d" number)) ()
|
`(comp-deftest ,(intern (format "ret-type-spec-%d" number)) ()
|
||||||
|
|
Loading…
Add table
Reference in a new issue