|
FFI:CAST segfault with gcc 3.2.2: msg#00070lisp.clisp.general
Recently I switched from gcc 2.95.3 to gcc 3.2.2. After recompiling CLISP, I discovered that, in some circumstances, FFI:CAST causes a segmentation fault. Test case: define the following foreign function: (def-call-out make-foreign-string (:name "make_foreign_string") (:arguments (s c-string :in)) (:return-type c-pointer :malloc-free)) void * make_foreign_string (const char *s) { int len = strlen(s); char *r = malloc (len); memcpy (r, s, len); return r; } try to convert its result to a '(c-ptr (c-array character ...)): [2]> (use-package :ffi) T [3]> (setf *x* (make-foreign-string "abcd")) #<FOREIGN-ADDRESS #x081B6680> [4]> (with-c-var (p 'c-pointer *x*) (cast p '(c-ptr (c-array uint8 4)))) #(97 98 99 100) OK, with bytes it works. [5]>(with-c-var (p 'c-pointer *x*) (cast p '(c-ptr (c-array character 4)))) Segmentation fault Any idea? ------------------------------------------------------- This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: RFE: debugging in separate window: 00070, Michael Koehne |
|---|---|
| Next by Date: | :malloc-free allocation -- here: instance methods: 00070, Aurelio Bignoli |
| Previous by Thread: | RFE: debugging in separate windowi: 00070, Hoehle, Joerg-Cyril |
| Next by Thread: | Re: FFI:CAST segfault with gcc 3.2.2: 00070, Sam Steingold |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |