emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: int/Lisp_Object mixup


From: Stefan Monnier
Subject: Re: int/Lisp_Object mixup
Date: Sat, 22 Feb 2003 17:06:42 -0500

> > Maybe it's just a coincidence, but I just noticed an unusually
> > large number of int/Lisp_Object mixups, so people please be
> > careful.  I needed the following patch in order to get the
> > code to compile with -DENABLE_CHECKING.
> 
> > BTW, even though the code compiles, it still fails to dump:
> 
> > LC_ALL=C ./temacs -batch -l loadup dump
> > Loading loadup.el (source)...
> > Using load-path (/home/monnier/work/trunk-emacs/lisp)
> > Loading byte-run...
> > Loading emacs-lisp/backquote...
> > Loading subr...
> > Loading version.el (source)...
> > Loading widget...
> > Loading custom...
> > Loading map-ynp...
> > Loading env...
> > Loading cus-start...
> > Loading international/mule...
> > Loading international/mule-conf.el (source)...
> > Invalid function: 0
> 
> By gdb, I found this.  The problem happens in
> Fmap_char_table.  It is defined as this:

Thanks, I now found a fix.


        Stefan


--- fns.c.~1.333.~      Tue Feb 18 12:00:35 2003
+++ fns.c       Sat Feb 22 17:04:16 2003
@@ -2699,6 +2698,14 @@
     }
 }
 
+static void void_call2 P_ ((Lisp_Object a, Lisp_Object b, Lisp_Object c));
+static void
+void_call2 (a, b, c)
+     Lisp_Object a, b, c;
+{
+  call2 (a, b, c);
+}
+
 DEFUN ("map-char-table", Fmap_char_table, Smap_char_table,
        2, 2, 0,
        doc: /* Call FUNCTION for each (normal and generic) characters in 
CHAR-TABLE.
@@ -2712,7 +2719,11 @@
 
   CHECK_CHAR_TABLE (char_table);
 
-  map_char_table ((POINTER_TYPE *) call2, Qnil, char_table, function, 0, 
indices);
+  /* When Lisp_Object is represented as a union, `call2' cannot directly
+     be passed to map_char_table because it returns a Lisp_Object rather
+     than returning nothing.
+     Casting leads to crashes on some architectures.  -stef  */
+  map_char_table (void_call2, Qnil, char_table, function, 0, indices);
   return Qnil;
 }
 





reply via email to

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