bug#58068: pretty-print corrupts data modified by set-cdr!

slbtty <[email protected]>
Newsgroups gmane.lisp.guile.bugs
Message-ID <CAFu5e0KXvXHOe5=55Tyu7drBUNo2h9MN9ymLf1p6vMkApmVR4w@mail.gmail.com>
GNU Guile 3.0.8

Using `guile3 < file.scm` to run the code below will makes the result
of tp unpredictable (pointing to very random things)

I am not sure about the set-cdr! and quote usage. However, i runned
the same code in other schemes, mit, chicken, racket/r6rs, gambit, and
they all yield tl as (1 2 3).

(use-modules (ice-9 pretty-print))
(define tl '(1 2))
(define tp (cdr tl))
(set-cdr! tp (cons 3 '()))
  (pretty-print tl)
  (pretty-print tp)
---

However, if i use plain old (display tp), the code will out put
expected valve (1 2 3) (3)
(define tl '(1 2))
(define tp (cdr tl))
(set-cdr! tp (cons 3 '()))
  (display tl) (newline)
  (display tp) (newline)

---

Context:

I am using guile3's repl and whenever i access a variable's by typing
its name after (set-cdr!), the result will goes wild.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.