unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
Cc: bug-guile@gnu.org, Steve Juranich <sjuranic@gmail.com>
Subject: Re: Bug in make-shared-array.
Date: Sat, 11 Mar 2006 00:07:11 +0000	[thread overview]
Message-ID: <87mzfxvo7k.fsf@ossau.uklinux.net> (raw)
In-Reply-To: <87ek1jjdcu.fsf@zip.com.au> (Kevin Ryde's message of "Sat, 04 Mar 2006 10:52:01 +1100")

Kevin Ryde <user42@zip.com.au> writes:

> "Steve Juranich" <sjuranic@gmail.com> writes:
>>
>> Are there any workarounds for this?
>
> There's something evil happening, I can't tell what it is.  Marius was
> the last to give the array bits a prod, he might be able to say.

I've fixed this in CVS now:

	* unif.c (scm_make_shared_array): Don't use SCM_I_ARRAY_BASE when
	oldra is not an array.  (Reported by Steve Juranich.)

But there's more dodgy-looking code in the same function: in lines
872-893, this -

	  if (s[k].inc > 0)
	    old_max += (s[k].ubnd - s[k].lbnd) * s[k].inc;
	  else
	    old_min += (s[k].ubnd - s[k].lbnd) * s[k].inc;

- suggests that (old_min, old_max) will be (inclusive, exclusive),
whereas in the non-array case this -

      old_base = old_min = 0;
      old_max = scm_c_generalized_vector_length (oldra) - 1;

- suggests (inclusive, inclusive).  And at line 899 this code -

      if (s[k].ubnd < s[k].lbnd)
	{
	  if (1 == SCM_I_ARRAY_NDIM (ra))
	    ra = make_typed_vector (scm_array_type (ra), 0);
	  else
	    SCM_I_ARRAY_V (ra) = make_typed_vector (scm_array_type (ra), 0);
	  scm_array_handle_release (&old_handle);
	  return ra;
	}

- suggests that the function will do something completely different if
one of the dimensions of the new array has a negative increment.

Anyone care to comment or to concoct new tests to explore these?

     Neil



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


  reply	other threads:[~2006-03-11  0:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-27 23:12 Bug in make-shared-array Steve Juranich
2006-03-03 23:52 ` Kevin Ryde
2006-03-11  0:07   ` Neil Jerram [this message]
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=87mzfxvo7k.fsf@ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=bug-guile@gnu.org \
    --cc=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).