From: Chris Hanson Date: Wed, 17 Jul 2019 23:17:24 +0000 (-0400) Subject: Don't choose the flo:+inf.0/flo:-inf.0 implementations at cold load. X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=85bec2ad1a9c719925f406729c305d169cc3e4c0;p=mit-scheme.git Don't choose the flo:+inf.0/flo:-inf.0 implementations at cold load. This is wrong because in our public distributions, the cold load is done on Ubuntu, but the code is supposed to run on any appropriate unix system. The fix is to make the selection when the band is restored, guaranteeing that it's running on the target system. Manual cherry-pick of 9b94290f82a99dfdb63ae94defcc8a92f2c0514d. --- diff --git a/src/runtime/floenv.scm b/src/runtime/floenv.scm index d1ce1e30d..72140c126 100644 --- a/src/runtime/floenv.scm +++ b/src/runtime/floenv.scm @@ -167,7 +167,7 @@ USA. (let ((fp-env* ((ucode-primitive float-environment 0)))) ((ucode-primitive set-float-environment 1) fp-env) fp-env*))))) - unspecific) + (initialize-flonum-infinities!)) (define (initialize-package!) (reset-package!) @@ -368,28 +368,29 @@ USA. (define flo:-inf.0) ;;; ZERO can be eliminated after 9.3 is released. It works around ;;; overly-aggressive constant folding in SF and LIAR. -(let ((zero (lambda () (identity-procedure 0.)))) - (if (flo:have-trap-enable/disable?) - (begin - (set! flo:nan.0 - (named-lambda (flo:nan.0) - (flo:with-exceptions-untrapped (flo:exception:invalid-operation) - (lambda () - (flo:/ 0. (zero)))))) - (set! flo:+inf.0 - (named-lambda (flo:+inf.0) - (flo:with-exceptions-untrapped (flo:exception:divide-by-zero) - (lambda () - (flo:/ +1. (zero)))))) - (set! flo:-inf.0 - (named-lambda (flo:-inf.0) - (flo:with-exceptions-untrapped (flo:exception:divide-by-zero) - (lambda () - (flo:/ -1. (zero)))))) - unspecific) - ;; This works on macOS. YMMV. - (begin - (set! flo:nan.0 (named-lambda (flo:nan.0) (flo:/ 0. (zero)))) - (set! flo:+inf.0 (named-lambda (flo:+inf.0) (flo:/ +1. (zero)))) - (set! flo:-inf.0 (named-lambda (flo:-inf.0) (flo:/ -1. (zero)))) - unspecific))) \ No newline at end of file +(define (initialize-flonum-infinities!) + (let ((zero (lambda () (identity-procedure 0.)))) + (if (flo:have-trap-enable/disable?) + (begin + (set! flo:nan.0 + (named-lambda (flo:nan.0) + (flo:with-exceptions-untrapped (flo:exception:invalid-operation) + (lambda () + (flo:/ 0. (zero)))))) + (set! flo:+inf.0 + (named-lambda (flo:+inf.0) + (flo:with-exceptions-untrapped (flo:exception:divide-by-zero) + (lambda () + (flo:/ +1. (zero)))))) + (set! flo:-inf.0 + (named-lambda (flo:-inf.0) + (flo:with-exceptions-untrapped (flo:exception:divide-by-zero) + (lambda () + (flo:/ -1. (zero)))))) + unspecific) + ;; This works on macOS. YMMV. + (begin + (set! flo:nan.0 (named-lambda (flo:nan.0) (flo:/ 0. (zero)))) + (set! flo:+inf.0 (named-lambda (flo:+inf.0) (flo:/ +1. (zero)))) + (set! flo:-inf.0 (named-lambda (flo:-inf.0) (flo:/ -1. (zero)))) + unspecific)))) \ No newline at end of file