master: map-refs: protect against unused results

stassats via Sbcl-commits <[email protected]>
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  345c44cd627ec73a7b8c70ddb4483fc84f596f27 (commit)
      from  8d178ceef1a1325d07c07ba569954458c93b3f8f (commit)

- Log -----------------------------------------------------------------
commit 345c44cd627ec73a7b8c70ddb4483fc84f596f27
Author: Stas Boukarev <[email protected]>
Date:   Tue Apr 7 02:32:38 2026 +0300

    map-refs: protect against unused results
    
    Fixes lp#2147383
---
 src/compiler/ir1util.lisp | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/src/compiler/ir1util.lisp b/src/compiler/ir1util.lisp
index 57db65883..552e3e064 100644
--- a/src/compiler/ir1util.lisp
+++ b/src/compiler/ir1util.lisp
@@ -3645,19 +3645,21 @@ is :ANY, the function name is not checked."
                                      do (recur v)))))
                           ((and (combination-p dest)
                                 (lvar-fun-is (combination-fun dest) '(values))
-                                (let ((mv (node-dest dest)))
-                                  (when (and multiple-uses
-                                             (consp (lvar-uses (node-lvar dest))))
-                                    (funcall multiple-uses))
-                                  (when (and (mv-combination-p mv)
-                                             (eq (basic-combination-kind mv) :local))
-                                    (let ((fun (combination-lambda mv)))
-                                      (when (and (functional-p fun)
-                                                 (functional-kind-eq fun mv-let))
-                                        (let* ((arg (position leaf/lvar (combination-args dest)))
-                                               (var (and arg (nth arg (lambda-vars fun)))))
-                                          (recur var)
-                                          t)))))))
+                                (let ((dest-lvar (node-lvar dest)))
+                                  (when dest-lvar
+                                    (let ((mv (lvar-dest dest-lvar)))
+                                      (when (and multiple-uses
+                                                 (consp (lvar-uses dest-lvar)))
+                                        (funcall multiple-uses))
+                                      (when (and (mv-combination-p mv)
+                                                 (eq (basic-combination-kind mv) :local))
+                                        (let ((fun (combination-lambda mv)))
+                                          (when (and (functional-p fun)
+                                                     (functional-kind-eq fun mv-let))
+                                            (let* ((arg (position leaf/lvar (combination-args dest)))
+                                                   (var (and arg (nth arg (lambda-vars fun)))))
+                                              (recur var)
+                                              t)))))))))
                           (t
                            (funcall function dest leaf/lvar))))))))
       (recur leaf/lvar))

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


hooks/post-receive
-- 
SBCL
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.