Steel Bank Common Lisp

erronous COERCE type derivation in unsafe code

Reported by Nikodemus Siivola on 2010-10-06
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
High
Unassigned

Bug Description

Unless SAFETY=3, (COERCE X '(VECTOR 5)) isn't oblidged to actually return a vector of length 5 -- just a vector.

Our DEFTRANSFORM for COERCE takes advantage of this, but the DERIVE-TYPE method for COERCE does not take this into account.

Either the DEFTRANSFORM has to be more conservative, or the DERIVE-TYPE needs to be more careful in unsafe code about the type it returns.

Try

(funcall (compile nil
                  `(lambda (x)
                    (declare (optimize speed))
                     (let ((v (coerce x '(simple-vector 1024))))
                      (gc)
                       (list (aref v 400) (aref v 500) (aref v 700) (aref v 1000)))))
         (vector t))

for all manner of excitement.

description: updated
Changed in sbcl:
assignee: nobody → Nikodemus Siivola (nikodemus)
status: Triaged → In Progress
Nikodemus Siivola (nikodemus) wrote :

In 1.0.43.67.

Changed in sbcl:
assignee: Nikodemus Siivola (nikodemus) → nobody
status: In Progress → Fix Committed
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers