[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: subtle byte-compiler bug
From: |
David PONCE |
Subject: |
Re: subtle byte-compiler bug |
Date: |
Wed, 7 Jan 2004 16:07:56 +0100 (CET) |
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
- Re: subtle byte-compiler bug,
David PONCE <=