guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: compiling with -DSCM_DEBUG=1


From: Ken Raeburn
Subject: Re: compiling with -DSCM_DEBUG=1
Date: Thu, 29 Oct 2009 18:16:17 -0400

At Andy's suggestion, re-posting the still-pending part that needs review. Without these changes, the code in the loops applies SCM_CAR to non-pair objects.

GUILE_AUTO_COMPILE=0                                    \
        ../meta/uninstalled-env                 \
guile-tools compile -Wunbound-variable -o "ice-9/debugger.go" "../../ guile/module/ice-9/debugger.scm" Non-pair accessed with SCM_C[AD]R: `#<procedure #f (#{class\ 2865}# . #{initargs\ 2866}#)>'

This patch is my best guess, but I'm not very familiar with the code...

SCM_DEBUG fix: Don't apply SCM_CAR to non-pairs when walking argument
    lists in method cache matching.

    * libguile/eval.i.c (CEVAL): Don't apply SCM_CAR to non-pairs when
      walking argument lists in method cache matching.
    * libguile/objects.c (scm_mcache_lookup_cmethod): Likewise.

diff --git a/libguile/eval.i.c b/libguile/eval.i.c
index d9ec6cd..e2e79c2 100644
--- a/libguile/eval.i.c
+++ b/libguile/eval.i.c
@@ -846,7 +846,7 @@ dispatch:
                {
                  SCM args = arg1; /* list of arguments */
                  z = SCM_SIMPLE_VECTOR_REF (method_cache, hash_value);
-                 while (!scm_is_null (args))
+                 while (scm_is_pair (z) && !scm_is_null (args))
                    {
                      /* More arguments than specifiers => CLASS != ENV */
                      SCM class_of_arg = scm_class_of (SCM_CAR (args));
diff --git a/libguile/objects.c b/libguile/objects.c
index f686c3a..09336cc 100644
--- a/libguile/objects.c
+++ b/libguile/objects.c
@@ -131,7 +131,7 @@ scm_mcache_lookup_cmethod (SCM cache, SCM args)
       long j = n;
       z = SCM_SIMPLE_VECTOR_REF (methods, i);
       ls = args; /* list of arguments */
-      if (!scm_is_null (ls))
+      if (!scm_is_null (ls) && scm_is_pair (z))
        do
          {
            /* More arguments than specifiers => CLASS != ENV */
@@ -140,7 +140,7 @@ scm_mcache_lookup_cmethod (SCM cache, SCM args)
            ls = SCM_CDR (ls);
            z = SCM_CDR (z);
          }
-       while (j-- && !scm_is_null (ls));
+       while (j-- && !scm_is_null (ls) && scm_is_pair (z));
/* Fewer arguments than specifiers => CAR != CLASS or `no- method' */
       if (!scm_is_pair (z)
|| (!SCM_CLASSP (SCM_CAR (z)) && !scm_is_symbol (SCM_CAR (z))))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]