From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ian Price Newsgroups: gmane.lisp.guile.bugs Subject: bug#15370: weirdness w/ uniform-vector-read! compat Date: Sun, 20 Oct 2013 09:59:26 +0100 Message-ID: <87r4bg1fo1.fsf@Kagami.home> References: <874n9obu1n.fsf@zigzag.favinet> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp X-Trace: ger.gmane.org 1382259616 23629 80.91.229.3 (20 Oct 2013 09:00:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2013 09:00:16 +0000 (UTC) Cc: 15370@debbugs.gnu.org To: Thien-Thi Nguyen Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Oct 20 11:00:21 2013 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VXorx-0005Ac-9I for guile-bugs@m.gmane.org; Sun, 20 Oct 2013 11:00:17 +0200 Original-Received: from localhost ([::1]:35466 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXorw-0005hV-NC for guile-bugs@m.gmane.org; Sun, 20 Oct 2013 05:00:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXorp-0005hH-Iv for bug-guile@gnu.org; Sun, 20 Oct 2013 05:00:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VXorl-0006bF-6P for bug-guile@gnu.org; Sun, 20 Oct 2013 05:00:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44639) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VXorl-0006ak-3x for bug-guile@gnu.org; Sun, 20 Oct 2013 05:00:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VXorj-00026Y-Ku for bug-guile@gnu.org; Sun, 20 Oct 2013 05:00:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ian Price Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 20 Oct 2013 09:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15370 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 15370-submit@debbugs.gnu.org id=B15370.13822595818033 (code B ref 15370); Sun, 20 Oct 2013 09:00:03 +0000 Original-Received: (at 15370) by debbugs.gnu.org; 20 Oct 2013 08:59:41 +0000 Original-Received: from localhost ([127.0.0.1]:58658 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXorM-00025U-NI for submit@debbugs.gnu.org; Sun, 20 Oct 2013 04:59:41 -0400 Original-Received: from mail-wg0-f43.google.com ([74.125.82.43]:39863) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXorK-00025G-5y for 15370@debbugs.gnu.org; Sun, 20 Oct 2013 04:59:38 -0400 Original-Received: by mail-wg0-f43.google.com with SMTP id b13so5250394wgh.34 for <15370@debbugs.gnu.org>; Sun, 20 Oct 2013 01:59:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=or4lHTXLu+i9ffPHU0gUacdv2ButYwzGDq1PAOEQIW0=; b=uFgY3V1OraE4g6zW8s/3xxTM6Z2PYHFR86olGLQxKYY3sdvNjiJRMEwiueLRfeaAiD qmZNl7Z98O4v/S6q2aogiyPpvT+6YWA6YGAUZoUyL11y90427/Kvgu1M0cBEC6cbm2s2 muIgYAOyAxO/rxgVc5ZXNYpv+awQyd3uIrCewfJ1WtGhRMUc16W1kKUmhqxVz8KvtYe7 UXTlt8RoEBW7QweVoq1LafMAv3L3VDZp8WouoLNgVbNwZQ/pV99Bm42UljWXVWqfK9cL /5h2chO/pqkonrQyfzBc3sNhXtHazePWSY/20b3mK8WS4yRTqi6I1neFV3xUx46UjIYi k8Ug== X-Received: by 10.180.221.38 with SMTP id qb6mr5496379wic.8.1382259572274; Sun, 20 Oct 2013 01:59:32 -0700 (PDT) Original-Received: from Kagami.home (host86-132-92-201.range86-132.btcentralplus.com. [86.132.92.201]) by mx.google.com with ESMTPSA id iz19sm20396047wic.9.2013.10.20.01.59.29 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 20 Oct 2013 01:59:31 -0700 (PDT) In-Reply-To: <874n9obu1n.fsf@zigzag.favinet> (Thien-Thi Nguyen's message of "Fri, 13 Sep 2013 17:49:56 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7310 Archived-At: Thien-Thi Nguyen 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"