unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: "Steve Juranich" <sjuranic@gmail.com>
Subject: Bug in make-shared-array.
Date: Mon, 27 Feb 2006 16:12:07 -0700	[thread overview]
Message-ID: <56190b6c0602271512x5b43963fh174f5335906b6dcf@mail.gmail.com> (raw)

I've tried posting a couple of messages about this via gmane.org, but
they still haven't posted to the list, that I can see.  Sorry if
people are seeing multiple versions of this.

There is a bug in scm_make_shared_array that causes things to break
when the input array is 1-d.  I thought I had a working patch for
this, but I don't.  Anyway, the offending line is libguile/unif.c:912:

  SCM_I_ARRAY_BASE (ra) = new_min = new_max = i + SCM_I_ARRAY_BASE (oldra);

As far as I can tell, there is a bug somewhere in the SCM_I_ARRAY_BASE
macro that causes things to break when oldra is a 1d uniform array. 
The value of the array base seems to be sane for multi-dimensional
arrays, but is something very strange for 1d arrays.

Here's the proof:

<buggy.c>
#include <stdio.h>
#include <libguile.h>

SCM
show_base_wrap(SCM ra) {
  size_t base = SCM_I_ARRAY_BASE(ra);
  printf("base = %d.\n", base);
  return SCM_UNSPECIFIED;
}

void
init_buggy () {
  scm_c_define_gsubr("show-base", 1, 0, 0, show_base_wrap);
}
</buggy.c>

Then the scheme code that shows this off would be:
<proof.scm>
#! /bin/bash
exec guile -s "$0" "$@"
!#

(use-modules (ice-9 format))

(setenv "LD_LIBRARY_PATH" (string-append ".:" (getenv "LD_LIBRARY_PATH")))

(load-extension "buggy" "init_buggy")

(define good #2((a b c) (d e f) (g h i)))
(define bad  #1(a b c d e f g h i))

(format #t "This one should work:~%~!")
(show-base good)

(format #t "While this one should be weird.~%~!")
(show-base bad)
</proof.scm>

Are there any workarounds for this?

BTW:
GCC 3.4.4
libtool-1.5.2
SuSE 9.3 everything else.

Thanks a bunch.
--
Steve Juranich
Tucson, AZ
USA


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


             reply	other threads:[~2006-02-27 23:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-27 23:12 Steve Juranich [this message]
2006-03-03 23:52 ` Bug in make-shared-array Kevin Ryde
2006-03-11  0:07   ` Neil Jerram
2006-05-01 21:48     ` Marius Vollmer
2006-05-01 22:13     ` Marius Vollmer
2006-05-01 23:07     ` Marius Vollmer
2006-05-03 23:29       ` Kevin Ryde
2006-05-04 17:55       ` Steve Juranich
2006-05-04 21:27         ` Marius Vollmer
2006-06-14  0:45       ` Neil Jerram
  -- strict thread matches above, loose matches on Subject: below --
2006-02-27 18:16 Steve Juranich
2006-02-27 16:16 Steve Juranich

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=56190b6c0602271512x5b43963fh174f5335906b6dcf@mail.gmail.com \
    --to=sjuranic@gmail.com \
    /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).