Ticket #519 (closed defect: fixed)

Opened 5 months ago

Last modified 4 months ago

write-char and put-char inlined incorrectly in v0.96

Reported by: will Owned by: will
Priority: critical Milestone: Larceny 0.97
Component: twobit Version: all
Keywords: write-char, put-char, inlining Cc:

Description

Reported by Ray Racine.

The write-char procedure evaluates its first argument twice when inlined, and the put-char procedure evaluates its second argument twice when inlined. This is a bug in the inlined code for put-char in common.imp.sch. Test case:

(let ((s "abcdefgh"))
  (define echochars
    (lambda (ip op)
      (let loop ((ch (peek-char ip)))
        (cond ((eof-object? ch)
               (get-output-string op))
              (else
               (write-char (read-char ip) op)
               (loop (peek-char ip)))))))
  (echochars (open-input-string s) (open-output-string)))

should return "abcdefgh", but returns "bdfh" in v0.96.

Change History

Changed 4 months ago by will

  • status changed from new to closed
  • resolution set to fixed

Fixed by changeset:5272 and v0.961.

Note: See TracTickets for help on using tickets.