Subject: Re: bug#6835: 23.2; eval'ing `type-of' with #[abc] as arg gets a Fatal error (11) Segmentation fault

From: Kevin Rodgers <[email-masked]>
Date: Mon, 09 Aug 2010 21:23:37 -0600

MON KEY wrote:
> eval'ing `type-of' with #[abc] gets me Fatal error (11) Segmentation fault
> 
> emacs -Q
> 
> To reproduce enter:
> (type-of  #[abc])
> 
> type C-x C-e `eval-last-sexp'
> 
> Get hosed with:
> => Fatal error (11)Segmentation fault
> 
> "GNU Emacs 23.2.1 (i686-pc-linux-gnu, GTK+ Version 2.20.0)
>  of 2010-05-10"

GNU Emacs 23.2.1 (i386-apple-darwin8.11.1, NS apple-appkit-824.48) of 2010-05-14

and

GNU Emacs 23.2.1 (i386-mingw-nt5.1.2600) of 2010-05-08

don't crash, but they both produce these results:

(type-of #[abc])
⇒ compiled-function

(functionp #[abc])
⇒ t

(funcall #[abc])
⇒ Debugger entered--Lisp error: (invalid-function #[abc])

Shouldn't anything that satisfies functionp be a valid argument to funcall?

Shouldn't the COMPILEDP macro in lisp.h be more strict about the number and type
of vector elements?  The "Byte-Code Function Objects" node of the Elisp manual
says:

    A byte-code function object must have at least four elements; there
is no maximum number, but only the first six elements have any normal
use.  They are:

ARGLIST
      The list of argument symbols.

BYTE-CODE
      The string containing the byte-code instructions.

CONSTANTS
      The vector of Lisp objects referenced by the byte code.  These
      include symbols used as function names and variable names.

STACKSIZE
      The maximum stack size this function needs.

DOCSTRING
      The documentation string (if any); otherwise, `nil'.  The value may
      be a number or a list, in case the documentation string is stored
      in a file.  Use the function `documentation' to get the real
      documentation string (*note Accessing Documentation::).

INTERACTIVE
      The interactive spec (if any).  This can be a string or a Lisp
      expression.  It is `nil' for a function that isn't interactive.

-- 
Kevin Rodgers
Denver, Colorado, USA