1.0.2.19: Fix fopcompiling references to undefined variables
[sbcl.git] / src / compiler / fopcompile.lisp
index 31e87f6..3162a8a 100644 (file)
                      (fopcompile `(symbol-value ',form) path for-value-p)
                      ;; Lexical
                      (when for-value-p
-                       (sb!fasl::dump-push (cdr (assoc form *fop-lexenv*))
-                                           *compile-object*)))))))
+                       (let ((handle (cdr (assoc form *fop-lexenv*))))
+                         (if handle
+                             (sb!fasl::dump-push handle
+                                                 *compile-object*)
+                             (progn
+                               ;; Undefined variable. Signal a warning, and
+                               ;; treat it as a special variable reference,
+                               ;; like the real compiler does.
+                               (note-undefined-reference form :variable)
+                               (fopcompile `(symbol-value ',form)
+                                           path
+                                           for-value-p))))))))))
         ((listp form)
          (multiple-value-bind (macroexpansion macroexpanded-p)
              (macroexpand form)