1.0.23.38: fix bug 430 (stack alloc by nested defstruct constructors)
[sbcl.git] / src / compiler / ltn.lisp
index b707b76..80f112a 100644 (file)
 ;;; return the leaf, otherwise return NIL.
 (defun lvar-delayed-leaf (lvar)
   (declare (type lvar lvar))
-  (let ((use (lvar-uses lvar)))
-    (and (ref-p use)
-         (let ((leaf (ref-leaf use)))
-           (etypecase leaf
-             (lambda-var (if (null (lambda-var-sets leaf)) leaf nil))
-             (constant leaf)
-             ((or functional global-var) nil))))))
+  (unless (lvar-dynamic-extent lvar)
+    (let ((use (lvar-uses lvar)))
+      (and (ref-p use)
+           (let ((leaf (ref-leaf use)))
+             (etypecase leaf
+               (lambda-var (if (null (lambda-var-sets leaf)) leaf nil))
+               (constant leaf)
+               ((or functional global-var) nil)))))))
 
 ;;; Annotate a normal single-value lvar. If its only use is a ref that
 ;;; we are allowed to delay the evaluation of, then we mark the lvar