From e86533e804513080f610795b9d43ca36ad842467 Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Fri, 30 Aug 2013 03:56:36 +0400 Subject: [PATCH] Fix floating point exceptions persisting on Solaris. (/ 0d0 0d0) (cosh 90) signaled an invalid-operation exception, and not overflow, on COSH, because the previous error wasn't cleared. Clear the exception flags in the sigfpe handler. --- NEWS | 1 + src/code/float-trap.lisp | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index b7268f3..90e9f8b 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ changes relative to sbcl-1.1.11: * bug fix: probe-file now can access symlinks to pipes and sockets in /proc/pid/fd on Linux. (reported by Eric Schulte) * bug fix: SBCL can now be built on Solaris x86-64. + * bug fix: Floating point exceptions do not persist on Solaris anymore. * bug fix: (setf . a) is pprinted correctly (reported by Douglas Katzman). changes in sbcl-1.1.11 relative to sbcl-1.1.10: diff --git a/src/code/float-trap.lisp b/src/code/float-trap.lisp index 6a02139..4bf0429 100644 --- a/src/code/float-trap.lisp +++ b/src/code/float-trap.lisp @@ -195,8 +195,12 @@ sets the floating point modes to their current values (and thus is a no-op)." (declare (type system-area-pointer info)) (let ((code (sb!unix::siginfo-code info))) (with-interrupts - (error (or (cdr (assoc code *sigfpe-code-error-alist*)) - 'floating-point-exception))))) + ;; Reset the accumulated exceptions, may be needed on other + ;; platforms too, at least Linux doesn't seem to require it. + #!+sunos + (setf (ldb sb!vm::float-sticky-bits (floating-point-modes)) 0) + (error (or (cdr (assoc code *sigfpe-code-error-alist*)) + 'floating-point-exception))))) ;;; Execute BODY with the floating point exceptions listed in TRAPS ;;; masked (disabled). TRAPS should be a list of possible exceptions -- 1.7.10.4