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: Kenichi Handa
Subject: Re: int/Lisp_Object mixup
Date: Sat, 22 Feb 2003 10:19:07 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.2.92 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

In article <address@hidden>, "Stefan Monnier" 
<monnier+gnu/emacs/address@hidden> writes:

> 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 foun this.  The problem happens in
Fmap_char_table.  It is defined as this:

DEFUN ("map-char-table", Fmap_char_table, Smap_char_table,
       2, 2, 0,
       doc: /* ... */)
     (function, char_table)
     Lisp_Object function, char_table;

It calls map_char_table, as this:

  map_char_table ((POINTER_TYPE *) call2, Qnil, char_table,
                  function, 0, indices);

map_char_table is defined as this:

void
map_char_table (c_function, function, subtable, arg, depth, indices)
     void (*c_function) P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
     Lisp_Object function, subtable, arg, *indices;
     int depth;

Then map_char_table calls `call2' as below (C_FUNCTION is
the above `call2', ARG is the above `function'):

          if (c_function)
            (*c_function) (arg, make_number (i), elt);

At this time, the type of ARG is Lisp_Vectorlike.

(gdb) p arg
$50 = {
  i = 1211762636, 
  s = {
    val = -130414644, 
    type = 4
  }, 
  u = {
    val = 138020812, 
    type = 4
  }, 
  gu = {
    val = 138020812, 
    type = Lisp_Vectorlike, 
    markbit = 0
  }
}

And call2 is defined as this:

/* ARGSUSED */
Lisp_Object
call2 (fn, arg1, arg2)
     Lisp_Object fn, arg1, arg2;

But, somehow, in call2, FN is changed to this.

(gdb) p fn
$49 = {
  i = 0, 
  s = {
    val = 0, 
    type = 0
  }, 
  u = {
    val = 0, 
    type = 0
  }, 
  gu = {
    val = 0, 
    type = Lisp_Int, 
    markbit = 0
  }
}

That's why "Invalid function: 0" is signaled.

But, I have no idea why call2 doesn't get a correct FN
argument.

---
Ken'ichi HANDA
address@hidden




reply via email to

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