From cb5cf4cd56029fe987108ce7d22493840957b143 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Tue, 3 Sep 2019 13:37:25 +0000 Subject: [PATCH] Mark floenv in use so exceptions stay cleared if preempted. Otherwise, we might do: T1: clear-float-exceptions preempt and switch T2: floating-point operation that raises exceptions preempt and switch T1: use-floating-point-environment! and the exceptions may remain raised from T2. --- src/runtime/floenv.scm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/runtime/floenv.scm b/src/runtime/floenv.scm index 149e815da..819c9bfc6 100644 --- a/src/runtime/floenv.scm +++ b/src/runtime/floenv.scm @@ -247,15 +247,15 @@ USA. (define (flo:set-trapped-exceptions! exceptions) (if (not (using-floating-point-environment?)) (begin - ((ucode-primitive clear-float-exceptions 1) exceptions) - (use-floating-point-environment!))) + (use-floating-point-environment!) + ((ucode-primitive clear-float-exceptions 1) exceptions))) ((ucode-primitive set-trapped-float-exceptions 1) exceptions)) (define (flo:trap-exceptions! exceptions) (if (not (using-floating-point-environment?)) (begin - ((ucode-primitive clear-float-exceptions 1) exceptions) - (use-floating-point-environment!))) + (use-floating-point-environment!) + ((ucode-primitive clear-float-exceptions 1) exceptions))) ((ucode-primitive trap-float-exceptions 1) exceptions)) (define (flo:untrap-exceptions! exceptions) -- 2.25.1