logo       

Re: FFI:CAST segfault with gcc 3.2.2: msg#00110

lisp.clisp.general

Subject: Re: FFI:CAST segfault with gcc 3.2.2

Sam Steingold writes:
> > * In message <m33cki5y87.fsf@xxxxxxxxxxxxxxxx>
> > * On the subject of "Re: [clisp-list] FFI:CAST segfault with gcc 3.2.2"
> > * Sent on 16 Apr 2003 10:11:04 -0400
> > * I write:
> >
> > > * Honorable Aurelio Bignoli <a.bignoli@xxxxxxxxxxxx> writes:
> > >
> > > [5]>(with-c-var (p 'c-pointer *x*) (cast p '(c-ptr (c-array character
> > > 4))))
> > > Segmentation fault
> >
> > I do not observe this with
> > gcc (GCC) 3.2.1 20021207 (Red Hat Linux 8.0 3.2.1-2)
>
> I _do_ observe this crash with gcc 3.2.1 when compiled with -O2.
> I do _not_ observe it when compiled with -g -O0.

I had also to add -falign-functions=4 to CFLAGS. Without it, lisp.run
prints the following error message when it is executed by make:

./lisp.run -B . -N locale -Efile UTF-8 -Eterminal UTF-8 -norc -m 750KW -x "(and
(load \"init.lisp\") (sys::%saveinitmem) (ext::exit))"
C_CODE_ALIGNMENT is wrong. &EVAL-WHEN = 0x806abd2.
Add -falign-functions=4 to CFLAGS in the Makefile.
make: *** [interpreted.mem] Aborted

> this is yet another instance where -O2 vs -g makes a difference.

the problem seems to be in the code generated by gcc for foreign.c,
probably for the function C_cast. I tried to compile it without "-O2
-fexpensive-optimizations" and all the other C modules with the usual
CFLAGS, and the resulting lisp.run passed the testsuite and the CAST
test. I'm currently using it.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise