Skip to content

Commit

Permalink
Fix %vector-widetag-and-n-bits-shift on unbounded numeric union types.
Browse files Browse the repository at this point in the history
Fixes lp#1769983
  • Loading branch information
stassats committed May 9, 2018
1 parent d9c5c02 commit b7773a8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
13 changes: 10 additions & 3 deletions src/code/array.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,16 @@
(cond ((not (every #'numeric-type-p types))
(result simple-vector-widetag))
((csubtypep ctype (specifier-type 'integer))
(integer-interval-widetag
(reduce #'min types :key #'numeric-type-low)
(reduce #'max types :key #'numeric-type-high)))
(block nil
(integer-interval-widetag
(dx-flet ((low (x)
(or (numeric-type-low x)
(return (result simple-vector-widetag)))))
(reduce #'min types :key #'low))
(dx-flet ((high (x)
(or (numeric-type-high x)
(return (result simple-vector-widetag)))))
(reduce #'max types :key #'high)))))
((csubtypep ctype (specifier-type 'double-float))
(result simple-array-double-float-widetag))
((csubtypep ctype (specifier-type 'single-float))
Expand Down
7 changes: 7 additions & 0 deletions tests/array.pure.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -547,3 +547,10 @@
(make-array 3 :initial-element #\a :element-type type))
(('(and character (satisfies eval))) "aaa" :test #'equal)
(('(and character (or (satisfies eval) base-char))) "aaa" :test #'equal)))

(with-test (:name :make-array-or-unsigned-byte-type)
(checked-compile-and-assert
()
'(lambda (type)
(make-array 1 :element-type type))
(('(or (eql -16) unsigned-byte)) #(0) :test #'equalp)))
4 changes: 2 additions & 2 deletions tests/compiler.pure.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -3520,9 +3520,9 @@
`(lambda ()
(list (if (typep ,v '(simple-array ,et (*)))
:good
:bad)
',et)
(if (typep (elt ,v 0) '(simple-array ,et (*)))
:bad
',et
:good))))))
(assert (equal '(:good :good) (funcall fun)))))))

Expand Down

0 comments on commit b7773a8

Please sign in to comment.