[Gsll-devel] clisp&cffi: broken foreign functions in saved images
Liam Healy
lhealy at common-lisp.net
Sun Aug 23 16:15:20 UTC 2009
On Sun, Aug 23, 2009 at 1:59 AM, Sam Steingold<sds at gnu.org> wrote:
> On Sat, Aug 22, 2009 at 3:48 PM, Liam Healy<lhealy at common-lisp.net> wrote:
>>
>> Which brings me to the real CLISP errors,
>> (lisp-unit:run-tests) ends after a few units with
>> *** - handle_fault error2 ! address = 0x8 not in [0x33497c000,0x3350de6d8) !
>> SIGSEGV cannot be cured. Fault address = 0x8.
>>
>> Do you see that? Do you know what could be causing it?
>
> chances are - bad ffi forms.
> if you can create an isolated test case, that would be a great help!
OK, this will cause the crash:
(make-chebyshev 40 'chebyshev-step 0.0d0 1.0d0)
I traced this down to the reinitialize-instance method for chebyshev,
which expands to something like
(DEFMETHOD REINITIALIZE-INSTANCE :AFTER
((OBJECT CHEBYSHEV) &KEY FUNCTIONS LOWER-LIMIT UPPER-LIMIT &AUX
(#:CBSTRUCT
(MAKE-CBSTRUCT 'FNSTRUCT
(WHEN (DIMENSION-NAMES OBJECT)
(MAPPEND 'LIST (DIMENSION-NAMES OBJECT)
(DIMENSIONS OBJECT)))
'FUNCTION 'CHEBYSHEV-CBFN0)))
(DECLARE (TYPE DOUBLE-FLOAT LOWER-LIMIT)
(TYPE DOUBLE-FLOAT UPPER-LIMIT) (IGNORE #:CBSTRUCT FUNCTIONS)
(SPECIAL CHEBYSHEV-DYNFN0))
(WITH-FOREIGN-OBJECTS ((#:CBSTRUCT 'T))
(MAKE-FUNCALLABLES-FOR-OBJECT OBJECT)
(SETF CHEBYSHEV-DYNFN0
(NTH 0 (FUNCALLABLES OBJECT)))
(LET ((#:CRETURN
(FOREIGN-FUNCALL "gsl_cheb_init"
:POINTER
(MPOINTER OBJECT)
:POINTER #:CBSTRUCT
:DOUBLE LOWER-LIMIT
:DOUBLE UPPER-LIMIT
:INT)))
(CHECK-GSL-STATUS #:CRETURN
'REINITIALIZE-INSTANCE)
(TRIVIAL-GARBAGE:FINALIZE OBJECT
(LAMBDA ()
(FOREIGN-FREE
#:CBSTRUCT)))
(VALUES OBJECT))))
so I guess the crash is in the cffi:foreign-funcall of gsl_cheb_init.
Could this be a case of incorrect expansion to CLISP ffi in
CFFI?
Liam
More information about the gsll-devel
mailing list