Subject: [clisp-list] Re: catch 22 compiling clisp for maxima: FFI crash

From: "Hoehle, Joerg-Cyril" <[email-masked]>
Date: Wed Jul 9 08:52:13 2003

Sam,

>> (PROGN (DEF-CALL-OUT C-SELF (:NAME "ffi_identity") (:ARGUMENTS (FIRST
>> (C-UNION (C1 (C-PTR CHARACTER)) (S (C-ARRAY-PTR CHARACTER)))) (OBJ
>> (C-PTR (C-UNION (C CHARACTER) (B BOOLEAN) (P C-POINTER))) :IN-OUT))
>> (:RETURN-TYPE (C-PTR CHARACTER)) (:LANGUAGE :STDC)) 
>(MULTIPLE-VALUE-LIST
>> (C-SELF #\w #\j)))
>> make[1]: *** [tests] Segmentation fault (core dumped)
>> make[1]: Leaving directory `/home/LFS/TODO/maxima/clisp/src/suite'
>
>This is FFI, it should not concern you either.
>Joerg Hoehle is working on this.

I've next to 0 time, but the split case you added for ffi.tst 1.13 is broken:
revision 1.13
date: 2003/06/17 18:42:33;  author: sds;  state: Exp;  lines: +22 -1
split the test that crashes on win32 into two

(progn
  (def-call-out c-self (:name "ffi_identity")
    (:arguments (obj (c-union (c1 character) ; BAD!
                              (s (c-array-ptr character)))))
    (:return-type (c-ptr character)) (:language :stdc))
  (c-self #\w))
is broken: you pass a character and return a pointer to character. That cannot be right. Did that test ever pass on any system?!

You probably meant to write (c-ptr (c-union (c1 character) ...)

(progn
  (def-call-out c-self (:name "ffi_identity")
    (:arguments (obj (c-ptr (c-union (c1 character)
                              (s (c-array-ptr character))))))
    (:return-type (c-ptr character)) (:language :stdc))
  (c-self #\w))
or maybe
(progn
  (def-call-out c-self (:name "ffi_identity")
    (:arguments (obj (c-union (c1 (c-ptr character))
                              (s (c-array-ptr character)))))
    (:return-type (c-ptr character)) (:language :stdc))
  (c-self #\w))
?
[Maybe add both forms :-)]

An arg of c-union type may point that ffcall has trouble with that (though I'm not sure ffcall gets to see that instead of the first union member)?? Which cases crashes on what systems?

Regards,
	Jorg Hohle.

---

From: Sam Steingold <[email-masked]>
Date: Wed Jul 9 09:46:20 2003

> * In message <[email-masked]>
> * On the subject of "Re: catch 22 compiling clisp for maxima: FFI crash"
> * Sent on Wed, 9 Jul 2003 17:51:22 +0200
> * Honorable "Hoehle, Joerg-Cyril" <[email-masked]> writes:
>
> I've next to 0 time

if not you, who?

>     (:return-type (c-ptr character)) (:language :stdc))
works

>     (:return-type (c-ptr character)) (:language :stdc))

segfaults.

> An arg of c-union type may point that ffcall has trouble with that
> (though I'm not sure ffcall gets to see that instead of the first
> union member)?? Which cases crashes on what systems?

all c-union (without c-ptr) crash on all systems.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Apathy Club meeting this Friday.  If you want to come, you're not invited.