GNU bug report logs - #4845
23.1.50; Uninterned symbols in .elc files

Previous Next

Package: emacs;

Reported by: Helmut Eller <eller.helmut <at> gmail.com>

Date: Sun, 1 Nov 2009 10:00:03 UTC

Severity: normal

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alan Mackenzie <acm <at> muc.de>
To: Marcin Borkowski <mbork <at> amu.edu.pl>
Cc: 4845 <at> debbugs.gnu.org, Helmut Eller <eller.helmut <at> gmail.com>
Subject: bug#4845: 23.1.50; Uninterned symbols in .elc files
Date: 19 Jan 2016 12:39:56 -0000
Hello, Marcin and Helmut.

In article <mailman.2481.1453074610.843.bug-gnu-emacs <at> gnu.org> you wrote:
> Hi,

> this message is just to mention that this bug seems to persist in GNU
> Emacs 25.1.50.1.

I'm convinced this is not a bug, though I could be wrong.

> Best,
> mb


> On 2009-11-01, at 09:25, Helmut Eller <eller.helmut <at> gmail.com> wrote:

>> In GNU Emacs 23.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.12.11)
>> loading a file x.el with contents

>>  (defmacro foo ()
>>    (let ((sym (make-symbol "bar")))
>>      `(progn
>>         (defun ,sym () (message "function %s called" ',sym))
>>         (,sym))))
>>
>>  (foo)

>> works as expected:

>>  shell> emacs -Q -batch -load x.el
>>  function bar called

>> However loading the corresponding compiled file signals an error:

>>  shell> emacs -Q -batch -eval '(byte-compile-file "x.el")' -load x.elc
>>  Wrote /tmp/x.elc
>>  Symbol's function definition is void: bar
>>  [Exit 255]

For reference, here are the contents of the compiled .elc file:

(defalias 'foo '(macro . #[nil "\301\302!^X\303\304^H\305\306\307\310^HDEF^HCE)\207" [sym make-symbol "bar" progn defun nil message "function %s called" quote] 8]))
(defalias 'bar #[nil "\300\301\302\"\207" [message "function %s called" #1=#:bar] 3])
(#:bar)

Important to note is that "(foo)" is expanded at byte compile time, not
at load time.  The uninterned symbol "bar" is created at compile time
during the expansion of "(foo)", but is not stored in the .elc file
anywhere.  That symbol thus exists only during the compilation of form
"(foo)" - at loading time it no longer exists.

Thus, trying to call "(#:bar)" at load time is doomed to fail.  (Though I
don't fully understand what "#:bar" means.)

There may be a bug in the compiler, in that it compiles a function
definition for the normal symbol 'bar rather than giving an error
message.

To fix the macro `foo', generate code to create the uninterned symbol at
run time rather than at compile time.  Maybe.

>> There is a #1=#:bar in the constant pool of the compiled function but #1
>> isn't used at the call site.

>> Helmut

-- 
Alan Mackenzie (Nuremberg, Germany).





This bug report was last modified 4 years and 187 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.