unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Dmitry Chestnykh <dmitry@codingrobots.com>
To: 10070@debbugs.gnu.org
Subject: bug#10070: bytevector-copy! overlapping behavior is not specified
Date: Thu, 17 Nov 2011 23:40:03 +0100	[thread overview]
Message-ID: <20111117234003.dd546e04c6613c318e452f83@codingrobots.com> (raw)

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	other threads:[~2011-11-17 22:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-17 22:40 Dmitry Chestnykh [this message]
2011-11-20  0:12 ` bug#10070: bytevector-copy! overlapping behavior is not specified Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111117234003.dd546e04c6613c318e452f83@codingrobots.com \
    --to=dmitry@codingrobots.com \
    --cc=10070@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).