"The value NIL is not of type SB-C::FUNCTIONAL", DELETE-OPTIONAL-DISPATCH with recursive local function.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Low
|
Unassigned |
Bug Description
Much to my surprise, the following code:
(defun m-a-o (fun start)
(let ((current start))
(labels ((maybe-map (obj obj-tag n-obj-bytes &optional ok)
(declare (inline maybe-map map-objects-
(
Yields the following when compiled (SBCL 1.1.7.25 or so):
debugger invoked on a TYPE-ERROR in thread
#<THREAD "main thread" RUNNING {AB37001}>:
The value NIL is not of type SB-C::FUNCTIONAL.
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-
0: [ABORT] Exit debugger, returning to top level.
(SB-C::
Removing the recursive call to map-objects-
I have enough else on my queue right now that trying to dig through the IR1 magic involved here isn't a high enough priority for me to do more than produce this reduced test case. Hopefully someone else can figure this one out, or maybe I'll get back to it at some point this decade.
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
A simplified test-case:
(recursed (&optional b)
( called)
( recursed) ))
(defun bug ()
(labels ((called (&optional a))
(declare (inline recursed called))
(recursed)))
and it looks like it's related to the inlined recursion, if I do (setf sb-ext: *inline- expansion- limit* 5), it doesn't happen, though it does with 6. So, looks like it breaks something when trying to delete the optional repeatedly.