From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Lucy Newsgroups: gmane.lisp.guile.bugs Subject: Bug in vector-move-right! Date: Fri, 26 Mar 2010 01:06:06 -0600 Message-ID: <52c42c3e1003260006o71310c3en51c92d91f5cc4e0a@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1269614114 2993 80.91.229.12 (26 Mar 2010 14:35:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 26 Mar 2010 14:35:14 +0000 (UTC) To: bug-guile@gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Fri Mar 26 15:35:10 2010 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NvAcv-0000bO-6e for guile-bugs@m.gmane.org; Fri, 26 Mar 2010 15:35:09 +0100 Original-Received: from localhost ([127.0.0.1]:48254 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvAcu-0004bF-Gn for guile-bugs@m.gmane.org; Fri, 26 Mar 2010 10:35:08 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nv3cn-0008Kb-A3 for bug-guile@gnu.org; Fri, 26 Mar 2010 03:06:33 -0400 Original-Received: from [140.186.70.92] (port=55871 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nv3cl-0008JE-B7 for bug-guile@gnu.org; Fri, 26 Mar 2010 03:06:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nv3cj-0003kK-OS for bug-guile@gnu.org; Fri, 26 Mar 2010 03:06:31 -0400 Original-Received: from mail-pw0-f41.google.com ([209.85.160.41]:52900) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nv3cj-0003jv-Al for bug-guile@gnu.org; Fri, 26 Mar 2010 03:06:29 -0400 Original-Received: by pwi2 with SMTP id 2so1750401pwi.0 for ; Fri, 26 Mar 2010 00:06:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:from:date :x-google-sender-auth:received:message-id:subject:to:content-type; bh=dColwNDM4oRCoWtaXKkkxcK5Vei2BsLK0KwXWHyn3SQ=; b=UjN0w9SFy+TvEY7QembcAnJlCk7FEMN+4QJR/SAe0+zKNTLzM7laqcKY0udMFLTSwV kb7Q1Egcsk8VH11X+zeA+jiGZhgaDIw+0RX/dEVBvKFRbtnExeFdiq7JJethl6iSXSCY J7sTDPftTdPkPNYQ4cGRG+i+ig+IPHSATB3ms= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:from:date:x-google-sender-auth:message-id :subject:to:content-type; b=trtakpYo1ILDOrN0wDssakbqJ2laLVcTjgY/DVgqRlHWJEir1O2sV5Gmf7xMyq3rt3 SjQAul1EIWLYrmaqJXm8ssAS7aTBPY6IEpbVgGjyja5aQu0trcDfpXYpWp0XxHq1rjVn EXsxnpQoBKCgG7Mp8Efe9zDyH2fSZeIoNdyEQ= Original-Received: by 10.140.203.16 with HTTP; Fri, 26 Mar 2010 00:06:06 -0700 (PDT) X-Google-Sender-Auth: 49d945ed5b4f78e6 Original-Received: by 10.140.255.13 with SMTP id c13mr470040rvi.152.1269587186109; Fri, 26 Mar 2010 00:06:26 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Fri, 26 Mar 2010 10:29:35 -0400 X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:4534 Archived-At: Hi, I think there's a bug in vector-move-right!. I'm using guile 1.9.9 as built from the git repository earlier today. This is the behavior I see: " scheme@(guile-user)> (define *v1* #(1 2 3 4 5 6 7 8 9)) scheme@(guile-user)> (define *v2* #(10 20 30 40 50 60 70 80 90)) scheme@(guile-user)> (vector-move-right! *v1* 0 2 *v2* 5) scheme@(guile-user)> *v2* #(10 20 30 1 2 60 70 80 90) " It seems to interpret the argument start2 as an ending index. I thought for a second that this might be intended behavior, but it says in the documentation that start2 is supposed to be an inclusive index, which it isn't. This is the behavior I expect: " scheme@(guile-user)> (define *v1* #(1 2 3 4 5 6 7 8 9)) scheme@(guile-user)> (define *v2* #(10 20 30 40 50 60 70 80 90)) scheme@(guile-user)> (vector-move-right! *v1* 0 2 *v2* 5) scheme@(guile-user)> *v2* #(10 20 30 40 50 1 2 80 90) " This is also the behavior already shown by vector-move-left! in the same context. If this is actually a bug rather than a documentation issue, it can be fixed by adding one line to libguile/vectors.c. Here's a diff: diff -c /home/zededarian/bak/vectors.c.old /home/zededarian/gg/libguile/vectors.c *** /home/zededarian/bak/vectors.c.old 2010-03-25 16:41:48.000000000 -0500 --- /home/zededarian/gg/libguile/vectors.c 2010-03-26 01:37:52.000000000 -0500 *************** *** 573,578 **** --- 573,580 ---- i = scm_to_unsigned_integer (start1, 0, len1); e = scm_to_unsigned_integer (end1, i, len1); j = scm_to_unsigned_integer (start2, 0, len2 - (i-e)); + + j += (e - i); i *= inc1; e *= inc1; Diff finished. Fri Mar 26 02:03:05 2010