#794 closed defect (invalid)
on 32bit systems srfi-4 make- procedures fail where make-vector succeeds
| Reported by: | Christian Kellermann | Owned by: | Christian Kellermann |
|---|---|---|---|
| Priority: | major | Milestone: | 4.9.0 |
| Component: | core libraries | Version: | 4.7.x |
| Keywords: | srfi-4 make-vector 32bit | Cc: | |
| Estimated difficulty: |
Description
$ csi -n
CHICKEN
(c)2008-2011 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 4.7.5 (rev b7f7e36)
openbsd-unix-gnu-x86 [ manyargs dload ptables ]
compiled 2012-03-02 on necronomicon.my.domain (OpenBSD)
#;1> (use srfi-4)
; loading /home/ckeen/chickens/master/lib/chicken/6/srfi-4.import.so ...
; loading library srfi-4 ...
#;2> (make-vector 12000000 0)
#(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
#;3> (make-u32vector 12000000 0)
Error: out of range
48000000
16777215
Call history:
<syntax> (make-u32vector 12000000 0)
<eval> (make-u32vector 12000000 0) <--
On 64 bit this works as expected. Affected is current master, 4.7.0 and the stability branch.
Change History (6)
comment:1 follow-up: 2 Changed 14 years ago by
comment:2 Changed 14 years ago by
Replying to ckeen:
16777215 is the biggest number that works, does that ring a bell?
forget this it is late...
comment:3 Changed 14 years ago by
| Status: | new → assigned |
|---|
Byte vector objects (strings, blobs) are limited to 24-bit length (0 - 16777215 bytes).
srfi-4 vectors are implemented with a srfi-4 header on top of a blob. Therefore u32 vectors are limited to 4,194,303 entries (since 4194303 words * 4 bytes/word = 16777212 bytes), in other words a 22-bit length.
So this can be chalked up to a confusing error message and a lack of documentation on the limits on srfi-4 vector length.
Naturally this occurs on 64-bit platforms as well, but the length is 54 bits instead of 56 bits, so you are unlikely to hit either limit; nor would I advise you to try.
comment:4 Changed 14 years ago by
A patch checking the length limits and producing better error messages as well as documenting these limits in the manual has been pushed to chicken-hackers for review.
comment:5 Changed 14 years ago by
| Resolution: | → invalid |
|---|---|
| Status: | assigned → closed |
Basically the error message is correct, the reasons could be explained better as Jim pointed out.

16777215 is the biggest number that works, does that ring a bell?