From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#4845: 23.1.50; Uninterned symbols in .elc files Date: 19 Jan 2016 12:39:56 -0000 Organization: muc.de e.V. Message-ID: <20160119123956.32358.qmail@mail.muc.de> References: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1453207223 13900 80.91.229.3 (19 Jan 2016 12:40:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 19 Jan 2016 12:40:23 +0000 (UTC) Cc: 4845@debbugs.gnu.org, Helmut Eller To: Marcin Borkowski Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 19 13:40:11 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aLVZz-0001kb-0C for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Jan 2016 13:40:11 +0100 Original-Received: from localhost ([::1]:36543 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLVZy-0001k2-3r for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Jan 2016 07:40:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60509) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLVZu-0001jv-3Z for bug-gnu-emacs@gnu.org; Tue, 19 Jan 2016 07:40:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLVZq-0007Az-1r for bug-gnu-emacs@gnu.org; Tue, 19 Jan 2016 07:40:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37024) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLVZp-0007AU-VG for bug-gnu-emacs@gnu.org; Tue, 19 Jan 2016 07:40:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aLVZp-00051m-Ly for bug-gnu-emacs@gnu.org; Tue, 19 Jan 2016 07:40:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Jan 2016 12:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 4845 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 4845-submit@debbugs.gnu.org id=B4845.145320719919314 (code B ref 4845); Tue, 19 Jan 2016 12:40:01 +0000 Original-Received: (at 4845) by debbugs.gnu.org; 19 Jan 2016 12:39:59 +0000 Original-Received: from localhost ([127.0.0.1]:53477 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aLVZn-00051S-8p for submit@debbugs.gnu.org; Tue, 19 Jan 2016 07:39:59 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:60679) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aLVZl-00051J-DJ for 4845@debbugs.gnu.org; Tue, 19 Jan 2016 07:39:57 -0500 Original-Received: (qmail 32359 invoked by uid 3782); 19 Jan 2016 12:39:56 -0000 In-Reply-To: X-Newsgroups: gnu.emacs.bug User-Agent: tin/2.3.1-20141224 ("Tallant") (UNIX) (FreeBSD/10.2-RELEASE-p9 (amd64)) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:111740 Archived-At: Hello, Marcin and Helmut. In article 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 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).