bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#15370: weirdness w/ uniform-vector-read! compat


From: Ian Price
Subject: bug#15370: weirdness w/ uniform-vector-read! compat
Date: Sun, 20 Oct 2013 09:59:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

Thien-Thi Nguyen <address@hidden> writes:

> ERROR: In procedure uniform-vector-read!:
> ERROR: In procedure get-bytevector-n!: Value out of range: 4
>
> FWIW, Guile 1.8.8 produces same output as ‘ok’ on a similar (sans the
> ‘use-modules’ and ‘uniform-vector-element-size’ noise) input, so i think
> this situation is a regression.  Am i missing something?

You'll notice that if you supply the parameters directly
e.g. (uniform-vector-read! uve port 0 1), it succeeds. That's enough to
pin it down to the lines

  c_end = SCM_UNBNDP (end) ? SCM_BYTEVECTOR_LENGTH (uvec) : scm_to_size_t (end);
  c_end *= c_width;

in scm_uniform_vector_read_x in libguile/deprecated.c 

Bytevector length returns the number of bytes, but end specifies the
index. We should only be multiplying the latter, not the former. Simple
fix is to fold the multiplication into the else branch of the
conditional.

Since this procedure is marked deprecated, I'd like to know how long it
has left before I patch it. Little point fixing it if it's soon...

Cheers
-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"





reply via email to

[Prev in Thread] Current Thread [Next in Thread]