chibi-scheme
chibi-scheme copied to clipboard
SRFI 231: array-extract doesn't preserve safety for specialized arrays
The symptom: This should fail, the indices are out of bounds:
> heine:~/programs/chibi-scheme> chibi-scheme
> (import (srfi 231))
> (define A (make-specialized-array (make-interval '#(4 4)) generic-storage-class #t #t))
> (define B (array-extract A (make-interval '#(2 2))))
> (array-ref B 2 2)
#t
I think something is a problem with specialized-array-share or %make-specialized-array, but I don't know where, precisely.
I just sent a pull request to fix this in the sample implementation and test suite.
For that matter, this should fail, too:
> heine:~> chibi-scheme
> (import (srfi 231))
> (define A (make-specialized-array (make-interval '#(4 4)) generic-storage-class #t #t))
> (array-ref A 0 10)
#t
Sorry, lost track of this. Yes, actually the bounds are currently only happening at the storage level, so can fail for shared arrays and non-specialized arrays. I can add these in.