| | @@ -612,7 +612,7 @@ |
| 612 | 612 | (when (is ty :string) |
| 613 | 613 | ;; a string constant is indexed and sliced as an array of U8 |
| 614 | 614 | (setf ty (make-array-type (ty-len ty) (basic "U8")) |
| 615 | | - item (make-item :mode :var :type ty :form (string-address (item-val item)) :ro :const :tok tk))) |
| 615 | + item (make-item :mode :var :type ty :form (string-address (item-val item)) :ro :string :tok tk))) |
| 616 | 616 | (unless (member (ty-kind ty) '(:array :slice :ptr)) |
| 617 | 617 | (fail-tok tk "~a can't be indexed" (type-name ty))) |
| 618 | 618 | (when (and (is ty :ptr) (is (ptr-base ty) :array)) |
| | @@ -755,6 +755,7 @@ |
| 755 | 755 | (case (item-ro a) |
| 756 | 756 | (:export (fail-tok tk "another module's variable can't be ~a" what)) |
| 757 | 757 | (:const (fail-tok tk "a constant can't be ~a" what)) |
| 758 | + (:string (fail-tok tk "a string's bytes can't be ~a" what)) |
| 758 | 759 | (:value (fail-tok tk "a part of a value can't be ~a" what)))) |
| 759 | 760 | |
| 760 | 761 | (defun vararg-form (a) |
| | @@ -893,7 +894,8 @@ |
| 893 | 894 | (arity args 1) |
| 894 | 895 | (let ((x (arg 0))) |
| 895 | 896 | (unless (eq (item-mode x) :var) (fail-tok tk "ADR takes a variable")) |
| 896 | | - (check-writable x tk "given to ADR") |
| 897 | + ;; a string's bytes have an address, as a ^U8 made from it does (5.10) |
| 898 | + (unless (eq (item-ro x) :string) (check-writable x tk "given to ADR")) |
| 897 | 899 | (when (item-noaddr x) (fail-tok tk "a field of a packed record has no address")) |
| 898 | 900 | (val-item (make-ptr-type (item-type x) (item-vol x)) (item-form x) tk))) |
| 899 | 901 | ((string= name "LEN") |