GNU bug report logs -
#44103
28.0.50; [feature/native-comp] let-bound dynamic variables are optimized away
Previous Next
Reported by: Kisaragi Hiu <mail <at> kisaragi-hiu.com>
Date: Tue, 20 Oct 2020 18:42:02 UTC
Severity: normal
Found in version 28.0.50
Done: Andrea Corallo <akrl <at> sdf.org>
Bug is archived. No further changes may be made.
Full log
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
Kisaragi Hiu via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:
> --text follows this line--
>
> Some functions use a dynamic (special, marked with defvar) variable to
> change their behaviors. In a lexically bound file, those dynamic
> variable bindings are currently optimized away.
>
> # Reproduction
>
> Run this function with the interpreter:
>
> ```elisp
> (defun k/test ()
> (with-current-buffer (get-buffer-create "testing")
> (erase-buffer)
> (let ((data '((a . "b") (c . "b")))
> (json-encoding-pretty-print t))
> (insert (json-encode data)))))
> ```
>
> the contents of #<buffer "testing"> after running `(k/test)` should be
>
> ```
> {
> "a": "b",
> "c": "b"
> }
> ```
>
> whereas if you native-compile the code, the contents would become
>
> ```
> {"a":"b","c":"b"}
> ```
>
> because `json-encoding-pretty-print` is optimized away (I think).
Hi Kisaragi,
I just tried native compiling this function but the result for me is the
first one (the expected).
Could you share a full recipe starting from emacs -Q to reproduce this
behavior?
Thanks!
Andrea
This bug report was last modified 4 years and 238 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.