[Git][cmucl/cmucl][rtoy-setexception-inexact] 2 commits: Disable FP traps when printing arithmetic-error messages

Raymond Toy rtoy at common-lisp.net
Sun Dec 27 18:37:08 UTC 2015


Raymond Toy pushed to branch rtoy-setexception-inexact at cmucl / cmucl


Commits:
0fc0061b by Raymond Toy at 2015-12-27T10:16:45Z
Disable FP traps when printing arithmetic-error messages

Printing of FP numbers can signal some traps like overflow, underflow,
inexact, or denormalized-operand, so we need to disable these traps
when printing out the error message for arithmetic errors.

- - - - -
62acaf64 by Raymond Toy at 2015-12-27T10:36:59Z
Merge branch 'master' into rtoy-setexception-inexact

- - - - -


1 changed file:

- src/code/error.lisp


Changes:

=====================================
src/code/error.lisp
=====================================
--- a/src/code/error.lisp
+++ b/src/code/error.lisp
@@ -1138,9 +1138,14 @@
 	     (format stream (intl:gettext "Arithmetic error ~S signalled.")
 		     (type-of condition))
 	     (when (arithmetic-error-operation condition)
-	       (format stream (intl:gettext "~%Operation was ~S, operands ~S.")
-		       (arithmetic-error-operation condition)
-		       (arithmetic-error-operands condition))))))
+	       ;; Printing the operands can signal these FP traps, so
+	       ;; disable them while we're printing out the error
+	       ;; message.
+	       (with-float-traps-masked (:overflow :underflow :inexact
+					 #+x86 :denormalized-operand)
+		 (format stream (intl:gettext "~%Operation was ~S, operands ~S.")
+			 (arithmetic-error-operation condition)
+			 (arithmetic-error-operands condition)))))))
 
 (define-condition division-by-zero         (arithmetic-error) ())
 (define-condition floating-point-overflow  (arithmetic-error) ())



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/compare/55b541e5fdac9794eae148597397bda915f96722...62acaf64300552a1f74237f57ee0b0b9985f76ad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20151227/44074bf2/attachment.html>


More information about the cmucl-cvs mailing list