0.pre8.111:
[sbcl.git] / src / compiler / typetran.lisp
index 06f0de1..c538f46 100644 (file)
             ((csubtypep tspec (specifier-type 'float))
              '(%single-float x))
             ((and (csubtypep tspec (specifier-type 'simple-vector))
-                  (policy node (< safety 3)))
+                  ;; Can we avoid checking for dimension issues like
+                  ;; (COERCE FOO '(SIMPLE-VECTOR 5)) returning a
+                  ;; vector of length 6?
+                  (or (policy node (< safety 3)) ; no need in unsafe code
+                      (and (array-type-p tspec) ; no need when no dimensions
+                           (equal (array-type-dimensions tspec) '(*)))))
              `(if (simple-vector-p x)
                   x
                   (replace (make-array (length x)) x)))
             (t
              (give-up-ir1-transform)))))))
 
+