unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bounds of 1-dimensional empty arrays
@ 2006-11-30 13:21 SZAVAI Gyula
  2006-11-30 13:36 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: SZAVAI Gyula @ 2006-11-30 13:21 UTC (permalink / raw)



guile-1.8-20061126


#1@10()
==> #()

(array-shape (make-array #t '(10 9)))
==> ((0 -1))

(make-shared-array #() (lambda x #f) '(10 9))
==> #()




--- orig/libguile/unif.c        2006-11-29 23:05:46.526091200 +0100
+++ mod/libguile/unif.c 2006-11-30 01:08:03.876683200 +0100
@@ -764,7 +764,7 @@
   SCM_I_ARRAY_V (ra) = creator (scm_from_size_t (rlen), fill);

   if (1 == SCM_I_ARRAY_NDIM (ra) && 0 == SCM_I_ARRAY_BASE (ra))
-    if (s->ubnd < s->lbnd || (0 == s->lbnd && 1 == s->inc))
+    if (0 == s->lbnd && 1 == s->inc)
       return SCM_I_ARRAY_V (ra);
   return ra;
 }
@@ -898,10 +898,7 @@
       inds = scm_cons (scm_from_long (s[k].lbnd), inds);
       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_I_ARRAY_V (ra) = make_typed_vector (scm_array_type (ra), 0);
          scm_array_handle_release (&old_handle);
          return ra;
        }




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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bounds of 1-dimensional empty arrays
  2006-11-30 13:21 bounds of 1-dimensional empty arrays SZAVAI Gyula
@ 2006-11-30 13:36 ` Ludovic Courtès
  2006-12-01 12:45   ` SZAVAI Gyula
  2006-12-01 19:59   ` Kevin Ryde
  0 siblings, 2 replies; 4+ messages in thread
From: Ludovic Courtès @ 2006-11-30 13:36 UTC (permalink / raw)
  Cc: bug-guile

Hi,

Thanks for all these bug fixes!  Note that I'm waiting for a few more
days so that I (or someone else) can review all of them in a row.  ;-)

BTW, it would be helpful if you could provide a ChangeLog entry or a
short sentence explaining the fix you propose.

Thanks,
Ludovic.



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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bounds of 1-dimensional empty arrays
  2006-11-30 13:36 ` Ludovic Courtès
@ 2006-12-01 12:45   ` SZAVAI Gyula
  2006-12-01 19:59   ` Kevin Ryde
  1 sibling, 0 replies; 4+ messages in thread
From: SZAVAI Gyula @ 2006-12-01 12:45 UTC (permalink / raw)


Ludovic Courtès írta:
> Thanks for all these bug fixes!  Note that I'm waiting for a few more
> days so that I (or someone else) can review all of them in a row.  ;-)
>   

I have these fixes, so don't hurry for me. ;-)

> BTW, it would be helpful if you could provide a ChangeLog entry or a
> short sentence explaining the fix you propose.
>   

1. negative bounds of literal arrays:
* libguile/unif.c (read_decimal_integer): don't drop sign
(scm_i_read_array): check for negative length

2. generic * and 0:
* libguile/numbers.c (scm_product): don't short-circuit before correct 
dispatching

However generic * is associative [1]. This should be changed or documented.

3. generic-capability?:
* oop/goops.scm: export generic-capability?

4. contents of empty shared array:
* libguile/unif.c (scm_make_shared_array): empty arrays are contiguous

5. bounds of 1-dimensional empty arrays:
* libguile/unif.c (scm_make_typed_array, scm_make_shared_array): don't 
drop wrapper object on 1-dimensional empty array if lower bound != 0

+1. array->list has same bug as vector->list,  see libguile/unif.c 
ra2l() [2]



[1]
(use-modules (oop goops))
(define-class <c> ())
(define-method (* a b (c <c>)))
(* 2 3 (make <c>))

Backtrace:
In current input:
   4: 0* [* 2 3 #<<c> ef85b0>]

<unnamed port>:4:1: In procedure * in expression (* 2 3 ...):
<unnamed port>:4:1: No applicable method for #<<generic> * (1)> in call 
(* 6 #<<
c> ef85b0>)
ABORT: (goops-error)


[2]
(let ((b (make-shared-array #(1) (lambda xs '(0)) 2 2)))
  (array->list b))
==> ((1))



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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bounds of 1-dimensional empty arrays
  2006-11-30 13:36 ` Ludovic Courtès
  2006-12-01 12:45   ` SZAVAI Gyula
@ 2006-12-01 19:59   ` Kevin Ryde
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin Ryde @ 2006-12-01 19:59 UTC (permalink / raw)


ludovic.courtes@laas.fr (Ludovic Courtès) writes:
>
> BTW, it would be helpful if you could provide a ChangeLog entry or a
> short sentence explaining the fix you propose.

(Copyright assignment will be needed for more than about 15 lines
cumulative ... which often makes just a pointer to the offending part
easier than an actual patch.)


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-12-01 19:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-30 13:21 bounds of 1-dimensional empty arrays SZAVAI Gyula
2006-11-30 13:36 ` Ludovic Courtès
2006-12-01 12:45   ` SZAVAI Gyula
2006-12-01 19:59   ` Kevin Ryde

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).