diff --git a/src/code/float-trap.lisp b/src/code/float-trap.lisp index 611feba546964eb0bcf20e7a92447e92b2d41bfc..8dbd3c31d9ee7e65e6602e90bfc84ac572eaef33 100644 --- a/src/code/float-trap.lisp +++ b/src/code/float-trap.lisp @@ -417,11 +417,14 @@ code))))))) (macrolet - ((with-float-traps (name logical-op docstring) + ((with-float-traps (name merge-traps docstring) ;; Define macros to enable or disable floating-point ;; exceptions. Masked exceptions and enabled exceptions only ;; differ whether we AND in the bits or OR them, respectively. - ;; Logical-op is the operation to use. + ;; MERGE-TRAPS is the logical operation to merge the traps with + ;; the current floating-point mode. Thus, use and MERGE-EXCEPTIONS is the + ;; logical operation to merge the exceptions (sticky bits) with + ;; the current mode. (let ((macro-name (symbolicate "WITH-FLOAT-TRAPS-" name))) `(progn (defmacro ,macro-name (traps &body body) @@ -450,7 +453,8 @@ (progn (setf (floating-point-modes) (ldb (byte 32 0) - (,',logical-op ,orig-modes ,(logand trap-mask exception-mask)))) + (logand (,',merge-traps ,orig-modes ,trap-mask) + ,exception-mask))) ,@body) ;; Restore the original traps and exceptions. (setf (floating-point-modes)