]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix two compiler ICEs dealing with nan and infinity
authorAndrea Corallo <akrl@sdf.org>
Tue, 2 Mar 2021 16:23:12 +0000 (17:23 +0100)
committerAndrea Corallo <akrl@sdf.org>
Wed, 3 Mar 2021 19:36:12 +0000 (20:36 +0100)
* 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.

lisp/emacs-lisp/comp-cstr.el
test/src/comp-test-funcs.el

index 996502b286901ed932e4c0ce615fc330b9543923..6a8ec5213d54b8b396c3c6798a6e6482994fd7b0 100644 (file)
@@ -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)
index 5bae743d1534ce9dbe8df07c60d61dd27222b01d..a465026fb37c01e2a222c123994391d6e3da6b75 100644 (file)
     (while (comp-test-no-return-3)
       (comp-test-no-return-3))))
 
+(defun comp-test-=-nan (x)
+  (when (= x 0.0e+NaN)
+    x))
+
+(defun comp-test-=-infinity (x)
+  (when (= x 1.0e+INF)
+    x))
+
 (provide 'comp-test-funcs)
 
 ;;; comp-test-funcs.el ends here