unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31688: 26.1.50; Byte compiler confuses two string variables
@ 2018-06-02 17:51 Gemini Lasswell
  2018-06-02 18:02 ` Noam Postavsky
  0 siblings, 1 reply; 16+ messages in thread
From: Gemini Lasswell @ 2018-06-02 17:51 UTC (permalink / raw)
  To: 31688

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)))





^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2018-06-08 15:09 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-02 17:51 bug#31688: 26.1.50; Byte compiler confuses two string variables Gemini Lasswell
2018-06-02 18:02 ` Noam Postavsky
2018-06-02 22:52   ` Gemini Lasswell
2018-06-02 23:25     ` Noam Postavsky
2018-06-03  0:40     ` Drew Adams
2018-06-02 23:03   ` Drew Adams
2018-06-02 23:38   ` Phil Sainty
2018-06-02 23:54     ` Noam Postavsky
2018-06-03 12:32       ` Phil Sainty
2018-06-03 13:05         ` Andreas Schwab
2018-06-04 10:02           ` Phil Sainty
2018-06-04 15:58             ` Eli Zaretskii
2018-06-04 17:01             ` Andreas Schwab
2018-06-08 15:09               ` Eli Zaretskii
2018-06-03  0:02     ` Michael Heerdegen
2018-06-03  0:46       ` Drew Adams

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).