Bug#503255: sbcl: Error using null pointer in ffi

David Matthew Mattli dmm at mattli.us
Fri Oct 24 16:41:35 UTC 2008


On Fri, Oct 24, 2008 at 12:49:52PM +0200, Luca Capello wrote:
> Hi there!
> 
> For the d-release list: this is a request about how to fix the bug below
> in time for lenny.
> 
> For everyone: please keep at least the bug report cc:ed, no subscription
> needed, TIA.
> 
> On Fri, 24 Oct 2008 01:48:53 +0200, David Matthew Mattli wrote:
> > Package: sbcl
> > Version: 1:1.0.18.0-1
> > Severity: important
> >
> > Whenever uses sbcl uses a null pointer in a cffi call it gives the following 
> > error:
> >
> > #.(SB-SYS:INT-SAP #X00000000) fell through ETYPECASE expression.
> >    Wanted one of (CHARACTER SYMBOL INTEGER). 
> >
> > This problem was not present in sbcl-1.0.17 and is fixed in 1.0.19.14. 
> > Updating sbcl to the latest version will fix this bug. This bug was reported 
> > and a fix reported on the sbcl-devel list.
> >
> > http://groups.google.com/group/sbcl-devel/browse_thread/thread/b67a3e18bb7a7dea
> 
> David, first of all thank you for the report.
> 
> I haven't looked yet at it in details, but is there any upstream bug
> opened, maybe with a patch that can backported to SBCL-1.0.17?  In that
> case the fix can be easily applied to the version already present in
> lenny and then the migration will be smoother.
> 
> On the contrary, if backporting the fix is not so trivial, let's see if
> the RM accepts a new source upload for lenny.
> 
> Thx, bye,
> Gismo / Luca

Luca, 

Thanks for your quick reply. I've tracked down the fixed applied in
the sbcl cvs for this specific issue.  The relevant messages to
sbcl-commit are here for x86:
http://sourceforge.net/mailarchive/forum.php?thread_name=E1KOy9Y-0006Iv-Uh%40sc8-pr-cvs8.sourceforge.net&forum_name=sbcl-commits

And here for amd64:
http://sourceforge.net/mailarchive/forum.php?thread_name=E1KOy9Z-0006Iy-1x%40sc8-pr-cvs8.sourceforge.net&forum_name=sbcl-commits

The following patch resolves the issue for me on x86 but I haven't
tested it on amd64.

Index: vm.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/compiler/x86/vm.lisp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- src/compiler/x86/vm.lisp    12 Apr 2007 14:55:07 -0000      1.28
+++ src/compiler/x86/vm.lisp    1 Aug 2008 17:10:23 -0000       1.29
@@ -384,7 +384,7 @@
 (!def-vm-support-routine immediate-constant-sc (value)
   (typecase value
     ((or (integer #.sb!xc:most-negative-fixnum #.sb!xc:most-positive-fixnum)
-         #-sb-xc-host system-area-pointer character)
+         character)
      (sc-number-or-lose 'immediate))
     (symbol
      (when (static-symbol-p value)

Index: vm.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/compiler/x86-64/vm.lisp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- src/compiler/x86-64/vm.lisp 10 Apr 2007 01:20:25 -0000      1.9
+++ src/compiler/x86-64/vm.lisp 1 Aug 2008 17:10:23 -0000       1.10
@@ -428,7 +428,7 @@
 (!def-vm-support-routine immediate-constant-sc (value)
   (typecase value
     ((or (integer #.sb!xc:most-negative-fixnum #.sb!xc:most-positive-fixnum)
-         #-sb-xc-host system-area-pointer character)
+         character)
      (sc-number-or-lose 'immediate))
     (symbol
      (when (static-symbol-p value)






More information about the pkg-common-lisp-devel mailing list