Comment 3 for bug 1382383

Revision history for this message
Douglas Katzman (dougk) wrote :

actually, the bug is in the derive-type optimizer of %array-data-vector.
[Which, incidentally is poorly named because it's really the %array-data-whatever]

The code is identical for derivation of %array-data-vector and array-storage-vector despite that they return different things.
The %array-data-vector is whatever the array is backed by, which can be another (possibly non-simple) array,
but the array-storage-vector is the "really" underlying vector after chasing an arbitrary number of displacements.
As such, the %array-data-vector on a 2d array displaced to a 3d-array should NOT return that its data-vector is a simple-array.

This is [a piece of] the buggy code in 'vm-tran'. It should pass a parameter to maybe-array-data-vector-type-specifier saying which thing its trying to do.

(macrolet ((def (name)
             `(defoptimizer (,name derive-type) ((array-lvar))
                (let ((spec (maybe-array-data-vector-type-specifier array-lvar)))
                  (when spec
                    (specifier-type spec))))))
  (def %array-data-vector)
  (def array-storage-vector))