From: David PONCE <david.ponce@wanadoo.fr>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: subtle byte-compiler bug
Date: Wed, 7 Jan 2004 16:07:56 +0100 (CET) [thread overview]
Message-ID: <16953250.1073488076347.JavaMail.www@wwinf0103> (raw)
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
next reply other threads:[~2004-01-07 15:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-07 15:07 David PONCE [this message]
2004-01-08 0:19 ` subtle byte-compiler bug Andreas Schwab
2004-01-08 13:38 ` Richard Stallman
-- strict thread matches above, loose matches on Subject: below --
2004-01-08 8:12 David PONCE
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16953250.1073488076347.JavaMail.www@wwinf0103 \
--to=david.ponce@wanadoo.fr \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).