diff options
author | Daniel Llorens <daniel.llorens@bluewin.ch> | 2016-04-21 17:38:49 +0200 |
---|---|---|
committer | Daniel Llorens <daniel.llorens@bluewin.ch> | 2016-07-11 09:11:50 +0200 |
commit | 79bf245c7e13b1cd1f47df533f78c6f676d66c56 (patch) | |
tree | 1323434d1da1ef9e41214a5803d4e90f324b802f /test-suite/tests/array-map.test | |
parent | f6003e88812c33e24e7038937e76e1292774ee98 (diff) | |
download | guile-79bf245c7e13b1cd1f47df533f78c6f676d66c56.tar.gz |
Fix a corner case with empty arrays in (array-for-each-cell)
* libguile/array-map.c (scm_array_for_each_cell): Bail out early if any
of the sizes is zero. Pack ais at the end of the fake stack.
* test-suite/tests/array-map.test: Add regression test.
Diffstat (limited to 'test-suite/tests/array-map.test')
-rw-r--r-- | test-suite/tests/array-map.test | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test-suite/tests/array-map.test b/test-suite/tests/array-map.test index f5487babc..cefe7b7e7 100644 --- a/test-suite/tests/array-map.test +++ b/test-suite/tests/array-map.test @@ -525,4 +525,16 @@ (let* ((x (list->typed-array 'f64 2 '((9 1) (7 8)))) (y (f64vector 99 99))) (array-for-each-cell 1 (lambda (y x) (array-set! y (- (array-ref x 0) (array-ref x 1)))) y x) - y))) + y)) + + (pass-if-equal "regression: zero-sized frame loop without unrolling" + 99 + (let* ((x 99) + (o (make-array 0. 0 3 2))) + (array-for-each-cell 2 + (lambda (o a0 a1) + (set! x 0)) + o + (make-shared-array (make-array 1. 0 1) (const '(0 0)) 0 3) + (make-array 2. 0 3)) + x))) |