Subject: 23.1.50; strange behaviour of a preloaded code containg macro

From: Kenichi Handa <[email-masked]>
Date: Thu, 27 Aug 2009 10:37:21 +0900

When I put the byte-compiled site-load.el that contains the
following code in .../emacs/lisp directory, and rebuild
emacs, that file is preloaded.

;; ------------------------------------------------------------
(eval-when-compile
  (put 'testsym 'char-table-extra-slots 0)
)

(defmacro testmacro ()
  (make-char-table 'testsym))

(defvar testdata (testmacro))

(defun testfunc ()
  (cons testdata (testmacro)))
;; ------------------------------------------------------------

When I call testfunc, it returns a cons of a char-table
(correct) and an empty vector (incorrect).

When I build much more complicated char-table in testmacro,
the cdr of the return value of testfunc is an invalid lisp
object that causes segfault.

When I remove site-load.elc and rebuild emacs (site-load.el
is preloaded), everything works correctly

This happens with Emacs 22, Emacs 23.1, and the trunk.

---
Kenichi Handa
[email-masked]

In GNU Emacs 23.1.50.12 (i686-pc-linux-gnu, GTK+ Version 2.14.4)
 of 2009-07-13 on etlken
Windowing system distributor `The X.Org Foundation', version 11.0.10502000
configured using `configure  'CFLAGS=-g''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ja_JP.UTF-8
  value of $XMODIFIERS: @im=SCIM
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Custom

Minor modes in effect:
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  display-time-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
/ s e n d m <tab> <return> C-x k <return> M-x M-p M-p 
<return> M-p <return> C-x k <return> M-x c u s t o 
<tab> C-g C-x C-f ~ / . e m <tab> <return> C-s m e 
s s a g e C-s C-s C-s C-s <escape> > C-M-a C-r c u 
s t o C-a C-s m e s s a g e C-s C-s C-s C-r C-r C-a 
C-v C-v C-v <escape> < C-s h o o k C-s C-s C-s C-s 
C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-a 
C-s m a i l C-a C-v C-v C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n ; ; SPC C-a C-v C-v C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n ; ; 
SPC C-a C-n C-n C-n C-n C-n C-n ; ; SPC C-a C-n C-n 
C-n C-n C-n C-M-n C-a C-n C-n C-p ; ; C-a C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n ; ; C-a C-n C-n C-u C-v 
C-u C-v C-v C-x C-s M-x c u s t o <tab> - <backspace> 
- g r <tab> <return> m a i <tab> l <tab> <return> C-h 
v m a i l <tab> C-g C-s C-a C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-f <help-echo> 
<help-echo> <down-mouse-1> <mouse-1> <down-mouse-5> 
<mouse-5> <double-down-mouse-5> <double-mouse-5> <help-echo> 
<help-echo> <down-mouse-1> <mouse-1> <help-echo> <down-mouse-1> 
<help-echo> <down-mouse-4> <mouse-4> <double-down-mouse-4> 
<double-mouse-4> <triple-down-mouse-4> <triple-mouse-4> 
<triple-down-mouse-4> <triple-mouse-4> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <down-mouse-1> 
<mouse-1> C-x b C-g M-x M-p M-p <return>

Recent messages:
Creating group magic...
Creating group state...
Creating group... done
Creating customization items ...done
Resetting customization items...done
Creating customization setup...done
Making completion list...
Quit
Mark set
byte-code: Beginning of buffer [2 times]
Quit

Load-path shadows:
/usr/local/share/emacs/site-lisp/ndspell hides /usr/local/share/emacs/site-lisp/lookup/ndspell
/usr/local/share/emacs/site-lisp/ndeb hides /usr/local/share/emacs/site-lisp/lookup/ndeb
/usr/local/share/emacs/site-lisp/ndtp hides /usr/local/share/emacs/site-lisp/lookup/ndtp
/usr/local/share/emacs/site-lisp/sdicf hides /usr/local/share/emacs/site-lisp/lookup/sdicf
/usr/local/share/emacs/site-lisp/lookup hides /usr/local/share/emacs/site-lisp/lookup/lookup
/usr/local/share/emacs/site-lisp/ndkks hides /usr/local/share/emacs/site-lisp/lookup/ndkks
/usr/local/share/emacs/site-lisp/ndict hides /usr/local/share/emacs/site-lisp/lookup/ndict
/usr/local/share/emacs/site-lisp/ndcookie hides /usr/local/share/emacs/site-lisp/lookup/ndcookie
/usr/local/share/emacs/site-lisp/stem-english hides /usr/local/share/emacs/site-lisp/lookup/stem-english
/usr/local/share/emacs/site-lisp/ndsrd hides /usr/local/share/emacs/site-lisp/lookup/ndsrd
/usr/local/share/emacs/site-lisp/lookup-utils hides /usr/local/share/emacs/site-lisp/lookup/lookup-utils
/usr/local/share/emacs/site-lisp/lookup-vars hides /usr/local/share/emacs/site-lisp/lookup/lookup-vars
/usr/local/share/emacs/site-lisp/lookup-types hides /usr/local/share/emacs/site-lisp/lookup/lookup-types
/usr/local/share/emacs/site-lisp/ndic hides /usr/local/share/emacs/site-lisp/lookup/ndic
/usr/local/share/emacs/site-lisp/lookup-select hides /usr/local/share/emacs/site-lisp/lookup/lookup-select
/usr/local/share/emacs/site-lisp/lookup-content hides /usr/local/share/emacs/site-lisp/lookup/lookup-content
/usr/local/share/emacs/site-lisp/rmail-mime/mime/pgg-pgp5 hides /usr/local/work/emacs/lisp/pgg-pgp5
/usr/local/share/emacs/site-lisp/rmail-mime/mime/pgg-def hides /usr/local/work/emacs/lisp/pgg-def
/usr/local/share/emacs/site-lisp/rmail-mime/mime/pgg-parse hides /usr/local/work/emacs/lisp/pgg-parse
/usr/local/share/emacs/site-lisp/rmail-mime/mime/pgg-pgp hides /usr/local/work/emacs/lisp/pgg-pgp
/usr/local/share/emacs/site-lisp/rmail-mime/mime/pgg hides /usr/local/work/emacs/lisp/pgg
/usr/local/share/emacs/site-lisp/rmail-mime/mail/sha1 hides /usr/local/work/emacs/lisp/sha1
/usr/local/share/emacs/site-lisp/rmail-mime/mail/hex-util hides /usr/local/work/emacs/lisp/hex-util
/usr/local/share/emacs/site-lisp/rmail-mime/mime/pgg-gpg hides /usr/local/work/emacs/lisp/pgg-gpg
~/gud/gud hides /usr/local/work/emacs/lisp/progmodes/gud
/usr/local/share/emacs/site-lisp/rmail-mime/mail/sasl-digest hides /usr/local/work/emacs/lisp/net/sasl-digest
/usr/local/share/emacs/site-lisp/rmail-mime/mail/hmac-md5 hides /usr/local/work/emacs/lisp/net/hmac-md5
/usr/local/share/emacs/site-lisp/rmail-mime/mail/sasl hides /usr/local/work/emacs/lisp/net/sasl
/usr/local/share/emacs/site-lisp/rmail-mime/mail/sasl-cram hides /usr/local/work/emacs/lisp/net/sasl-cram
/usr/local/share/emacs/site-lisp/rmail-mime/mail/hmac-def hides /usr/local/work/emacs/lisp/net/hmac-def
/usr/local/share/emacs/site-lisp/rmail-mime/mail/feedmail hides /usr/local/work/emacs/lisp/mail/feedmail
/usr/local/share/emacs/site-lisp/rmail-mime/mail/smtpmail hides /usr/local/work/emacs/lisp/mail/smtpmail
/usr/local/share/emacs/site-lisp/rmail-mime/mime/smime hides /usr/local/work/emacs/lisp/gnus/smime
/usr/local/work/emacs/lisp/language/thai-word hides ~/emacslisp/thai-word
/usr/local/work/emacs/lisp/textmodes/tex-mode hides ~/emacslisp/tex-mode
/usr/local/work/emacs/lisp/textmodes/table hides ~/emacslisp/table
/usr/local/work/emacs/lisp/emacs-lisp/syntax hides ~/emacslisp/syntax
/usr/local/work/emacs/lisp/progmodes/prolog hides ~/emacslisp/prolog