Raymond Toy pushed to branch master
at cmucl / cmucl
Commits:
-
edb5af9b
by Raymond Toy
at 2015-12-29T18:24:24Z
WITH-FLOAT-TRAPS-ENABLED was incorrectly setting accrued exceptions.
Fix issue #14.
WITH-FLOAT-TRAPS-ENABLED was leaving the accrued (and current)
exceptions unchanged, but it should have cleared out any values there
that matched the exceptions to be enabled. Without this, the next x87
operation would signal an exception if an accrued exception matched
an enabled exception. This was the cause of issue #14. (Note that
for x87, the accrued exception is the same as current exception.)
-
a610d96c
by Raymond Toy
at 2015-12-30T02:36:39Z
Merge branch 'rtoy-issue-14' into 'master'
WITH-FLOAT-TRAPS-ENABLED was incorrectly setting accrued exceptions.
Fix issue #14.
WITH-FLOAT-TRAPS-ENABLED was leaving the accrued (and current)
exceptions unchanged, but it should have cleared out any values there
that matched the exceptions to be enabled. Without this, the next x87
operation would signal an exception if an accrued exception matched
an enabled exception. This was the cause of issue #14. (Note that
for x87, the accrued exception is the same as current exception.)
See merge request !5
1 changed file:
Changes:
src/code/float-trap.lisp
--- 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)