From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: David PONCE Newsgroups: gmane.emacs.pretest.bugs,gmane.emacs.devel Subject: Re: subtle byte-compiler bug Date: Wed, 7 Jan 2004 16:07:56 +0100 (CET) Sender: emacs-pretest-bug-bounces+gebp-emacs-pretest-bug=gmane.org@gnu.org Message-ID: <16953250.1073488076347.JavaMail.www@wwinf0103> Reply-To: david.ponce@wanadoo.fr NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1073488217 22440 80.91.224.253 (7 Jan 2004 15:10:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 7 Jan 2004 15:10:17 +0000 (UTC) Cc: emacs-devel Original-X-From: emacs-pretest-bug-bounces+gebp-emacs-pretest-bug=gmane.org@gnu.org Wed Jan 07 16:10:09 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AeFJx-0000o6-00 for ; Wed, 07 Jan 2004 16:10:09 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AeGGn-00037P-SZ for gebp-emacs-pretest-bug@gmane.org; Wed, 07 Jan 2004 11:10:57 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AeGGY-00033E-Bm for emacs-pretest-bug@gnu.org; Wed, 07 Jan 2004 11:10:42 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AeGFz-0002lv-Ep for emacs-pretest-bug@gnu.org; Wed, 07 Jan 2004 11:10:39 -0500 Original-Received: from [193.252.22.30] (helo=mwinf0101.wanadoo.fr) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AeGFK-0002UT-O9; Wed, 07 Jan 2004 11:09:26 -0500 Original-Received: from wwinf0103 (wwinf0103 [172.22.132.30]) by mwinf0101.wanadoo.fr (SMTP Server) with ESMTP id 56F12C0001BD; Wed, 7 Jan 2004 16:07:56 +0100 (CET) Original-To: emacs-pretest-bug X-BeenThere: emacs-pretest-bug@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-pretest-bug-bounces+gebp-emacs-pretest-bug=gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.pretest.bugs:1758 gmane.emacs.devel:19077 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:19077 Hi, Oliver Scholz wrote: > David Ponce (CCed here) suggested that this is a bug in the > byte-compiler. He also noted that this bug is not in 21.3. [...] I finally got a little time to investigate on that problem and discovered that the bug is not in the byte-compiler but in the `prin1' primitive. Sometimes `prin1' print incorrect uninterned symbol references, that can result in writing invalid byte-compiled code. Here is a small example of code that illustrates the bug: (let* ((n 512) (print-escape-newlines t) (print-length nil) (print-level nil) (print-quoted t) (print-gensym t) (v (make-vector n (list 1 2 3))) (tmp1 (make-symbol "defconst-tmp-var")) (tmp2 (make-symbol "defconst-tmp-var")) ) (aset v 3 `(lambda (,tmp1) (defconst v1 ,tmp1))) (aset v 8 `(lambda (,tmp2) (defconst v2 ,tmp2))) (prin1 v)) When I eval it in the *scratch* buffer, `prin1' print something like the following, which is obviously incorrect :-( [(1 2 3) (1 2 3) (1 2 3) (lambda (#:defconst-tmp-var) (defconst v1 #:defconst-tmp-var)) (1 2 3) (1 2 3) (1 2 3) (1 2 3) (lambda (#:defconst-tmp-var) (defconst v2 #:defconst-tmp-var)) (1 2 3) (1 2 3) (1 2 3) (1 2 3) (1 2 3) (1 2 3) ...] However, If I simply change (n 512) to (n 511) in the `let' expression, the printed result is then correct: [(1 2 3) (1 2 3) (1 2 3) (lambda (#1=#:defconst-tmp-var) (defconst v1 #1#)) (1 2 3) (1 2 3) (1 2 3) (1 2 3) (lambda (#2=#:defconst-tmp-var) (defconst v2 #2#)) (1 2 3) (1 2 3) (1 2 3) (1 2 3) (1 2 3) (1 2 3) ...] I am running: GNU Emacs 21.3.50.1 (i686-pc-linux-gnu, GTK+ Version 2.2.4) of 2004-01-07 configured using `configure '--prefix=/home/ponce' '--with-x-toolkit=gtk'' 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: en_US.UTF-8 locale-coding-system: utf-8 default-enable-multibyte-characters: t Hope this will help. Sincerely, David