diff --git a/compiler/pack.lisp b/compiler/pack.lisp index c15db72e468d39165b3bdff5dae7e79ad2b33ca1..9833fe7e1169f57a12e6d189056d4d2e4aae1550 100644 --- a/compiler/pack.lisp +++ b/compiler/pack.lisp @@ -772,7 +772,8 @@ (or (eq (sb-kind target-sb) :unbounded) (member loc (sc-locations sc))) (= (sc-element-size target-sc) (sc-element-size sc)) - (not (conflicts-in-sc tn sc loc))) + (not (conflicts-in-sc tn sc loc)) + (zerop (mod loc (sc-alignment sc)))) loc nil))) @@ -840,9 +841,10 @@ (declare (type tn tn) (type sc sc) (inline member)) (let* ((sb (sc-sb sc)) (element-size (sc-element-size sc)) + (alignment (sc-alignment sc)) (size (finite-sb-current-size sb)) (start-offset (finite-sb-last-offset sb))) - (let ((current-start start-offset) + (let ((current-start (* (ceiling start-offset alignment) alignment)) (wrap-p nil)) (declare (type index current-start)) (loop @@ -859,9 +861,10 @@ (return-from select-location current-start)) (let ((offset (+ current-start i))) (when (offset-conflicts-in-sb tn sb offset) - (setq current-start (1+ offset)) + (setq current-start + (* (ceiling (1+ offset) alignment) alignment)) (return)))) - (incf current-start)))))) + (incf current-start alignment)))))) ;;;; Load TN packing: