GNU bug report logs - #10070
bytevector-copy! overlapping behavior is not specified

Previous Next

Package: guile;

Reported by: Dmitry Chestnykh <dmitry <at> codingrobots.com>

Date: Thu, 17 Nov 2011 22:56:01 UTC

Severity: normal

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 10070 in the body.
You can then email your comments to 10070 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#10070; Package guile. (Thu, 17 Nov 2011 22:56:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dmitry Chestnykh <dmitry <at> codingrobots.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Thu, 17 Nov 2011 22:56:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Chestnykh <dmitry <at> codingrobots.com>
To: bug-guile <at> gnu.org
Subject: bytevector-copy! overlapping behavior is not specified
Date: Thu, 17 Nov 2011 23:40:03 +0100
Hello,

Documentation for bytevector-copy! doesn't specify whether source and
target may overlap (or the order of copying), it only says:

    "Copy len bytes from source into target, starting reading from
    source-start (a positive index within source) and start writing
    at target-start."

R6RS specifies this:

   "This must work even if the memory regions for the source and the
   target overlap, i.e., the bytes at the target location after the
   copy must be equal to the bytes at the source location before the
   copy."

Looking at the code in bytevectors.c I see that the function uses
memcpy() instead of memmove(). Am I correct that in the current Guile
implementation, bytevectors must not overlap, that is, the effect of

   (bytevector-copy! source i1 source i2 len)

depends on the implementation of memcpy() in libc, and may behave
differently on different platforms?

Proposal:

1. Specify behavior of bytevector-copy! in the documentation.
2. If the current implementation is not correct, fix this ;-)

Thank you!

-- 
Dmitry Chestnykh
http://www.codingrobots.org




Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Sun, 20 Nov 2011 00:15:02 GMT) Full text and rfc822 format available.

Notification sent to Dmitry Chestnykh <dmitry <at> codingrobots.com>:
bug acknowledged by developer. (Sun, 20 Nov 2011 00:15:02 GMT) Full text and rfc822 format available.

Message #10 received at 10070-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Dmitry Chestnykh <dmitry <at> codingrobots.com>
Cc: 10070-done <at> debbugs.gnu.org
Subject: Re: bug#10070: bytevector-copy! overlapping behavior is not specified
Date: Sun, 20 Nov 2011 01:12:57 +0100
Hi Dmitry,

Thanks for the report!  I fixed it by using memmove as you suggested:

  http://git.sv.gnu.org/cgit/guile.git/commit/?id=8071964943e23700cfe1095ba0f5e3c99f590dee

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 18 Dec 2011 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 125 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.