From f14793c4624c58912ccae0d0db90dff87c46030a Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Tue, 3 Nov 2015 14:11:49 -0600 Subject: [PATCH] Remove potentially incorrect unsafe operation. --- typed-racket-lib/typed-racket/base-env/prims.rkt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/typed-racket-lib/typed-racket/base-env/prims.rkt b/typed-racket-lib/typed-racket/base-env/prims.rkt index da4921b3..0ac4028b 100644 --- a/typed-racket-lib/typed-racket/base-env/prims.rkt +++ b/typed-racket-lib/typed-racket/base-env/prims.rkt @@ -808,7 +808,13 @@ the typed racket language. (define i 0) (for (clauses ...) (define v body-expr) - (cond [(unsafe-fx= i 0) (define new-vs (ann (make-vector n v) T)) + ;; can't use `unsafe-fx=` here + ;; if `n` is larger than a fixnum, this is unsafe, and we + ;; don't know whether that's the case until we try creating + ;; the vector + ;; other unsafe ops are after vector allocation, and so are + ;; fine + (cond [(= i 0) (define new-vs (ann (make-vector n v) T)) (set! vs new-vs)] [else (unsafe-vector-set! vs i v)]) (set! i (unsafe-fx+ i 1))