Broken binary search in sb-vm::%simple-fun-from-entrypoint
Bug #1942191 reported by
Marco Heisig
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
To reproduce: (sb-vm:
Code objects whose code-n-entries is 1 trigger a "The value -1 is not of type (unsigned-byte 16).", because the MAX variable assumes a value of -1 after the first iteration of the binary search.
This bug breaks SAVE-LISP-AND-DIE when statically linking the core. It was introduced by 278ad85561efdd7
Changed in sbcl: | |
status: | New → Fix Committed |
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
That's interesting, but there are literally thousands of code objects with 1 entry, so this can't be the whole story. Do you have an example of breakage without directly calling it?
If I put a trace on those two functions and call save-lisp-and-die, they work fine.
0: (SB-VM: :FIND-CALLED- OBJECT 1386265968) :%SIMPLE- FUN-FROM- ENTRYPOINT #<code id=3605 [1] SB-KERNEL: TWO-ARG- GCD {52A0BD1F}> 1386265968) %SIMPLE- FUN-FROM- ENTRYPOINT returned TWO-ARG- GCD> FIND-CALLED- OBJECT returned #<FUNCTION SB-KERNEL: TWO-ARG- GCD>
1: (SB-VM:
1: SB-VM::
#<FUNCTION SB-KERNEL:
0: SB-VM::
etc
I think the error stems from: if the callee is not found, then binary-search fails.
However, not finding a callee, in the context of save-lisp-and-die, is an illegal state.
So I don't mind the failure of binary search. It's catching some other problem.