summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/comp-cstr.el
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2021-03-02 17:23:12 +0100
committerAndrea Corallo <akrl@sdf.org>2021-03-03 20:36:12 +0100
commit0c5ba41b72a19f5353083431a1817d86bc3b7fad (patch)
tree354266f25e8a38b611314a0c7658b55f9675d168 /lisp/emacs-lisp/comp-cstr.el
parent30810905de7662b36b7ac9275bb9cbb2a563c277 (diff)
downloademacs-0c5ba41b72a19f5353083431a1817d86bc3b7fad.tar.gz
emacs-0c5ba41b72a19f5353083431a1817d86bc3b7fad.tar.bz2
emacs-0c5ba41b72a19f5353083431a1817d86bc3b7fad.zip
Fix two compiler ICEs dealing with nan and infinity
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-=): Don't crash when truncate fails. * test/src/comp-test-funcs.el (comp-test-=-nan): Add two functions to be compiled.
Diffstat (limited to 'lisp/emacs-lisp/comp-cstr.el')
-rw-r--r--lisp/emacs-lisp/comp-cstr.el9
1 files changed, 6 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
index 996502b2869..6a8ec5213d5 100644
--- a/lisp/emacs-lisp/comp-cstr.el
+++ b/lisp/emacs-lisp/comp-cstr.el
@@ -871,9 +871,12 @@ Non memoized version of `comp-cstr-intersection-no-mem'."
;; precisely as an integer add the integer as well.
(cl-loop
for v in (valset cstr)
- when (and (floatp v)
- (= v (truncate v)))
- do (push (cons (truncate v) (truncate v)) (range cstr)))
+ do
+ (when-let* ((ok (floatp v))
+ (truncated (ignore-error 'overflow-error
+ (truncate v)))
+ (ok (= v truncated)))
+ (push (cons truncated truncated) (range cstr))))
(cl-loop
with vals-to-add
for (l . h) in (range cstr)