XEPs, let conversion, and inlining
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
High
|
Unassigned |
Bug Description
From sbcl-bugs by cage:
((lambda ()
(declare (optimize debug))
(block nil
(flet ((fun (x) (unless (funcall #'null x) (return))))
(declare (inline fun))
(map-into (vector 1) #'fun (coerce #(1) 'vector))))))
failed AVER:
(NOT
(SB-
removing substitute-
(declaim (inline bar))
(defun bar (f)
(funcall f))
(defun foo ()
((lambda ()
(declare (optimize debug))
(block nil
(flet ((fun () (return)))
(declare (inline fun))
(bar #'fun))))))
with substitute-
failed AVER: (NOT (SB-C::
without:
failed AVER: (SUBSETP SB-C::END SB-C::END-STACK)
A test cases which fails the same either way:
(defun moo ())
(declaim (inline bar))
(defun bar (f)
(multiple-
(defun foo ()
((lambda ()
(declare (optimize debug))
(block nil
(flet ((fun () (return)))
(declare (inline fun))
(bar #'fun))))))
The value NIL is not of type SB-C::NODE.
summary: |
- substitute-let-funargs causing a failed AVER + XEPs, let conversion and inlining |
summary: |
- XEPs, let conversion and inlining + XEPs, let conversion, and inlining |
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
It is influenced by %coerce- callable- to-fun
(declaim (inline bar))
(defun bar (f)
(%funcall f))
(defun foo ()
((lambda ()
(declare (optimize debug))
(block nil
(flet ((fun () (return nil)))
(declare (inline fun))
(bar #'fun))))))
Doesn't fail
while callable- to-fun f))) HAS-EXTERNAL- REFERENCES- P CLAMBDA))
(defun bar (f)
(%funcall (%coerce-
does with
(NOT (FUNCTIONAL-
doing
(defknown x (t) t)
(deftransform x ((fun))
'fun)
(defun bar (f)
(%funcall (x f)))
gives failed AVER: (SUBSETP END END-STACK)
the difference is %coerce- callable- to-fun gives up once