unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] fix broken slot allocation
@ 2003-04-06 11:57 Andy Wingo
  2003-04-07 18:16 ` Mikael Djurfeldt
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Wingo @ 2003-04-06 11:57 UTC (permalink / raw)


Hello,

You'll probably get my previous message first detailing the problem (I
haven't had internet in a few days, there's some mail sitting in the
queue...). I looked through the sources and came up with a patch -- the
index was not getting updated in the new (as of january, according to
the Changelog) allocation-avoidance code. Seems pretty trivial:

--- guile-1.6-1.6.3.orig/libguile/goops.c
+++ guile-1.6-1.6.3/libguile/goops.c
@@ -505,12 +505,10 @@
       len = scm_ilength (SCM_CDAR (slots));
       allocation = scm_i_get_keyword (k_allocation, SCM_CDAR (slots),
 				      len, k_instance, FUNC_NAME);
-      while (!SCM_EQ_P (allocation, k_instance))
-	{
+      if (!SCM_EQ_P (allocation, k_instance))
+	{
 	  slots = SCM_CDR (slots);
-	  len = scm_ilength (SCM_CDAR (slots));
-	  allocation = scm_i_get_keyword (k_allocation, SCM_CDAR (slots),
-					  len, k_instance, FUNC_NAME);
+	  continue;
 	}
       type = scm_i_get_keyword (k_class, SCM_CDAR (slots),
 				len, SCM_BOOL_F, FUNC_NAME);

The aforementioned problem with guile-gobject goes away when this patch
is applied.

Regards,

wingo.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


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

* Re: [PATCH] fix broken slot allocation
  2003-04-06 11:57 [PATCH] fix broken slot allocation Andy Wingo
@ 2003-04-07 18:16 ` Mikael Djurfeldt
  2003-04-11  9:29   ` Mikael Djurfeldt
  0 siblings, 1 reply; 4+ messages in thread
From: Mikael Djurfeldt @ 2003-04-07 18:16 UTC (permalink / raw)
  Cc: guile-devel

Andy Wingo <wingo@pobox.com> writes:

> You'll probably get my previous message first detailing the problem (I
> haven't had internet in a few days, there's some mail sitting in the
> queue...). I looked through the sources and came up with a patch -- the
> index was not getting updated in the new (as of january, according to
> the Changelog) allocation-avoidance code. Seems pretty trivial:
>
> --- guile-1.6-1.6.3.orig/libguile/goops.c
> +++ guile-1.6-1.6.3/libguile/goops.c
> @@ -505,12 +505,10 @@
>        len = scm_ilength (SCM_CDAR (slots));
>        allocation = scm_i_get_keyword (k_allocation, SCM_CDAR (slots),
>  				      len, k_instance, FUNC_NAME);
> -      while (!SCM_EQ_P (allocation, k_instance))
> -	{
> +      if (!SCM_EQ_P (allocation, k_instance))
> +	{
>  	  slots = SCM_CDR (slots);
> -	  len = scm_ilength (SCM_CDAR (slots));
> -	  allocation = scm_i_get_keyword (k_allocation, SCM_CDAR (slots),
> -					  len, k_instance, FUNC_NAME);
> +	  continue;
>  	}
>        type = scm_i_get_keyword (k_class, SCM_CDAR (slots),
>  				len, SCM_BOOL_F, FUNC_NAME);
>
> The aforementioned problem with guile-gobject goes away when this patch
> is applied.

Obviously, the original code is buggy.  However, your fix is not
correct: Slots which don't have instance allocation should not have a
corresponding layout entry, so the index should indeed not be updated.

Best regards,
Mikael D.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


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

* Re: [PATCH] fix broken slot allocation
  2003-04-07 18:16 ` Mikael Djurfeldt
@ 2003-04-11  9:29   ` Mikael Djurfeldt
  2003-04-11  9:42     ` Mikael Djurfeldt
  0 siblings, 1 reply; 4+ messages in thread
From: Mikael Djurfeldt @ 2003-04-11  9:29 UTC (permalink / raw)
  Cc: djurfeldt

Mikael Djurfeldt <djurfeldt@nada.kth.se> writes:

>> The aforementioned problem with guile-gobject goes away when this patch
>> is applied.
>
> Obviously, the original code is buggy.  However, your fix is not
> correct: Slots which don't have instance allocation should not have a
> corresponding layout entry, so the index should indeed not be updated.

I finally got a moment to look at this.  It turns out that the goops.c
code looks correct.  The problem seems to be in guile-gobject.

Could you please give me instructions how to provoke this bug?
(Please make it as simple as possible).

Best regards,
Mikael D.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


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

* Re: [PATCH] fix broken slot allocation
  2003-04-11  9:29   ` Mikael Djurfeldt
@ 2003-04-11  9:42     ` Mikael Djurfeldt
  0 siblings, 0 replies; 4+ messages in thread
From: Mikael Djurfeldt @ 2003-04-11  9:42 UTC (permalink / raw)
  Cc: djurfeldt

Mikael Djurfeldt <djurfeldt@nada.kth.se> writes:

> Could you please give me instructions how to provoke this bug?
> (Please make it as simple as possible).

Sorry---found your original bug report---that will be sufficient.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


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

end of thread, other threads:[~2003-04-11  9:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-06 11:57 [PATCH] fix broken slot allocation Andy Wingo
2003-04-07 18:16 ` Mikael Djurfeldt
2003-04-11  9:29   ` Mikael Djurfeldt
2003-04-11  9:42     ` Mikael Djurfeldt

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