unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: "Daniel Llorens del Río" <daniel.llorens@bluewin.ch>
To: guile-devel@gnu.org
Subject: bug in scm_arrray_handle_[srfi tag]_elements
Date: Mon, 11 Jan 2010 19:49:07 +0100	[thread overview]
Message-ID: <992C8B41-B3DB-4482-9C6B-679B1CE9E7A9@bluewin.ch> (raw)
In-Reply-To: <0JCC00MW3LBEPQ@imap0.epfl.ch>


Hello,

That function and the _writable_elements() version are broken for  
shared arrays because they return a pointer to the beginning of the  
enclosing array instead of a pointer to their own beginning.

This patch against master fixes the issue for me. Cf. the  
implementation of scm_array_handle_uniform_writable_elements() in  
uniform.c.

---
  libguile/srfi-4.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libguile/srfi-4.c b/libguile/srfi-4.c
index 4b7eadc..f38fbcf 100644
--- a/libguile/srfi-4.c
+++ b/libguile/srfi-4.c
@@ -119,13 +119,13 @@
     
{                                                                     \
      if (h->element_type != ETYPE  
(TAG))                                 \
        scm_wrong_type_arg_msg (NULL, 0, h->array, #tag  
"vector");        \
-    return h->elements;                               \
+    return h->elements+h->base*scm_array_handle_uniform_element_size 
(h);\
    }                                                                    
   \
    ctype* scm_array_handle_##tag##_writable_elements  
(scm_t_array_handle *h) \
     
{                                                                     \
      if (h->element_type != ETYPE  
(TAG))                                 \
        scm_wrong_type_arg_msg (NULL, 0, h->array, #tag  
"vector");        \
-    return h->writable_elements;                      \
+    return h->writable_elements+h- 
 >base*scm_array_handle_uniform_element_size(h); \
    }                                                                    
   \
    const ctype *scm_##tag##vector_elements (SCM  
uvec,                    \
                                             scm_t_array_handle  
*h,       \
-- 

Thanks,

	Daniel






       reply	other threads:[~2010-01-11 18:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0JCC00MW3LBEPQ@imap0.epfl.ch>
2010-01-11 18:49 ` Daniel Llorens del Río [this message]
2010-01-11 23:22   ` bug in scm_arrray_handle_[srfi tag]_elements Andy Wingo
2010-01-11 23:49     ` Daniel Llorens del Río
2010-01-12  0:54       ` Daniel Llorens del Río
2010-01-12 19:16       ` Andy Wingo
2010-01-12 19:48         ` Daniel Llorens del Río

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=992C8B41-B3DB-4482-9C6B-679B1CE9E7A9@bluewin.ch \
    --to=daniel.llorens@bluewin.ch \
    --cc=guile-devel@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).