master: Fix a read-char transform

stassats via Sbcl-commits <[email protected]> Sun, 24 May 2026 00:51:42 +0000
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  8817a07e6c37a73086b29d420fa72fb59aa356ba (commit)
      from  8bd18308746d7212b1e02e81fc1a75573baee400 (commit)

- Log -----------------------------------------------------------------
commit 8817a07e6c37a73086b29d420fa72fb59aa356ba
Author: Stas Boukarev <[email protected]>
Date:   Sun May 24 03:49:38 2026 +0300

    Fix a read-char transform
    
    ansi-stream-in might return multiple values.
    
    Reported by J Klein.
---
 src/compiler/srctran.lisp | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/compiler/srctran.lisp b/src/compiler/srctran.lisp
index 2ed12172a..914a0a083 100644
--- a/src/compiler/srctran.lisp
+++ b/src/compiler/srctran.lisp
@@ -9337,16 +9337,20 @@
   (delete-lvar-cast-if (specifier-type '(or stream boolean)) stream)
   `(block nil
      (or (and (sb-impl::ansi-stream-p stream)
-              (let* ((buffer (sb-impl::ansi-stream-cin-buffer stream))
-                     (index (ansi-stream-in-index stream)))
+              (let ((buffer (sb-impl::ansi-stream-cin-buffer stream))
+                    (index (ansi-stream-in-index stream)))
                 (if buffer
                     (when (/= index sb-impl::+ansi-stream-in-buffer-length+)
                       (prog1
                           (aref buffer index)
                         (setf (ansi-stream-in-index stream) (1+ index))))
-                    (return (funcall (ansi-stream-in stream) stream ,(if eof-error-p
-                                                                         'eof-error-p
-                                                                         t) eof-value)))))
+                    (return
+                      (values (funcall (ansi-stream-in stream)
+                                       stream
+                                       ,(if eof-error-p
+                                            'eof-error-p
+                                            t)
+                                       eof-value))))))
          (locally (declare (notinline read-char))
            (read-char ,@(loop for (lvar var) on (list stream 'stream
                                                       eof-error-p 'eof-error-p

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL