1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Fix compilation of rank 0 typed array literals

* module/system/vm/assembler.scm (simple-uniform-vector?): array-length
  fails for rank 0 arrays; fix the shape condition.

* test-suite/tests/arrays.test: Test reading of #0f64(x) in compilation
  context.
This commit is contained in:
Daniel Llorens 2015-02-12 13:02:24 +01:00
parent 8b5f323330
commit d236d4d33f
2 changed files with 10 additions and 2 deletions

View file

@ -1001,7 +1001,9 @@ immediate, and @code{#f} otherwise."
(define (simple-uniform-vector? obj)
(and (array? obj)
(symbol? (array-type obj))
(equal? (array-shape obj) (list (list 0 (1- (array-length obj)))))))
(match (array-shape obj)
(((0 n)) #t)
(else #f))))
(define (statically-allocatable? x)
"Return @code{#t} if a non-immediate constant can be allocated

View file

@ -204,7 +204,13 @@
(with-test-prefix/c&e "array-equal?"
(pass-if "#s16(...)"
(array-equal? #s16(1 2 3) #s16(1 2 3))))
(array-equal? #s16(1 2 3) #s16(1 2 3)))
(pass-if "#0f64(...)"
(array-equal? #0f64(99) (make-typed-array 'f64 99)))
(pass-if "#0(...)"
(array-equal? #0(99) (make-array 99))))
;;;
;;; make-shared-array