Ticket #7 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

bad register targeting in (setf (aref ...) ...) of 2-dimensional array of element-type T.

Reported by: gb Owned by: gb
Priority: major Milestone:
Component: Compiler Version: 1.1
Keywords: Cc:

Description

This code:

(defun matrix-times-matrix (mat1 mat2)
  "Multiplies two matrices together"
  (if (= (array-dimension mat1 1)
         (array-dimension mat2 0))
      (let ((result (make-array (list (array-dimension mat1 0)
                                      (array-dimension mat2 1)))))
        (dotimes (row (array-dimension result 0))
          (dotimes (column (array-dimension result 1))
            (let ((terms 0))
              (dotimes (middle (array-dimension mat1 1))
                (setf terms (+ terms (* (or (aref mat1 row middle) 0)
                                        (or (aref mat2 middle column) 0)))))
              (setf (aref result row column) terms))))
        (return-from matrix-times-matrix result))
      (progn
        (format t "~&Illegal matrix multiplication:
Matrix sizes ~a x ~a and ~a x ~a don't match."
                (array-dimension mat1 0)
                (array-dimension mat1 1)
                (array-dimension mat2 0)
                (array-dimension mat2 1))
        (return-from matrix-times-matrix nil))))

blows up in the compiler, when it discovers that it has to go through the write barrier at .SPgvset and that things are in the wrong registers for that.

It is possible that this just got exposed in 040708, because previous versions may have gotten MAKE-ARRAY type inferencing wrong

Change History

comment:1 Changed 7 years ago by gb

  • Status changed from new to assigned

It'd certainly be worth checking the 3-d case as well.

comment:2 Changed 7 years ago by gb

  • Status changed from assigned to closed
  • Resolution set to fixed

Should be fixed by changeset:6258.

Note: See TracTickets for help on using tickets.