erronous COERCE type derivation in unsafe code

Bug #655872 reported by Nikodemus Siivola
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
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.

Tags: compiler types
description: updated
Changed in sbcl:
assignee: nobody → Nikodemus Siivola (nikodemus)
status: Triaged → In Progress
Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.