--- Begin Message ---
Subject: |
26.1.50; Byte compiler confuses two string variables |
Date: |
Sat, 02 Jun 2018 10:51:18 -0700 |
Here is a test which succeeds when interpreted and fails when
byte-compiled. The byte compiler is apparently confusing two string
variables, or optimizing away one of them. I've tried it both
with and without lexical-binding with the same results.
To reproduce, save this to bug.el:
(require 'ert)
(ert-deftest test-strings-props ()
(let* ((str1 "abcdefghij")
(obj '(a b))
(str2 "abcdefghij"))
(put-text-property 0 5 'test obj str2)
(should (equal "\"abcdefghij\"" (prin1-to-string str1)))))
Then:
C-u M-x byte-compile-file RET bug.el RET
M-x ert RET t RET
Result:
(ert-test-failed
((should
(equal "\"abcdefghij\""
(prin1-to-string str1)))
:form
(equal "\"abcdefghij\"" "#(\"abcdefghij\" 0 5 (test (a b)))")
:value nil :explanation
(arrays-of-different-length 12 32 "\"abcdefghij\"" "#(\"abcdefghij\" 0 5
(test (a b)))" first-mismatch-at 0)))
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#31688: 26.1.50; Byte compiler confuses two string variables |
Date: |
Fri, 08 Jun 2018 18:09:35 +0300 |
> From: Andreas Schwab <address@hidden>
> Date: Mon, 04 Jun 2018 19:01:16 +0200
> Cc: Gemini Lasswell <address@hidden>, Noam Postavsky <address@hidden>,
> bug-gnu-emacs <address@hidden>,
> address@hidden
>
> On Jun 04 2018, Phil Sainty <address@hidden> wrote:
>
> > Surely consistent behaviour between compiled and uncompiled code is
> > not only desirable, but a primary goal?
>
> Not if you are using self-modifying code.
Thanks to everyone who participated in the discussion. I have now
added some explanation of these issues to the ELisp manual, and I'm
closing the bug report.
--- End Message ---