[Gc] Gc segfault with gcc-3.4 and Gc segfault under valgrind

Boehm, Hans hans.boehm at hp.com
Wed Oct 25 10:37:22 PDT 2006


The GC is not expected to work out of the box with valgrind.  Others
might have gotten further than this.

I'm not immediately sure what's causing the segmentation fault.  It may
be the collector's root finding mechanism found some of the valgrind
data and tried to scan it.

It would be nice to get this to work.  Until it does, you might try the
GC_DEBUG support in the collector itself.  That's clearly not a valgrind
replacement.  At best it helps with heap corruption.

In theory -Wstrict-prototypes should probably work with gc7.  This
hasn't been checked, but patches to fix it would certainly be
appreciated.

My goal with -Wall and similar is to at least document any remaining
warnings in the source.  The collector inherently does a few things that
should generate warnings in "normal" code, e.g. it returns the address
of a local to get an upper bound on the stack pointer.  This also really
applies only to gc7.

Hans

> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com 
> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Eric Deplagne
> Sent: Wednesday, October 25, 2006 7:01 AM
> To: gc at napali.hpl.hp.com
> Subject: [Gc] Gc segfault with gcc-3.4 and Gc segfault under valgrind
> 
>   Hi.
> 
>   I might be getting to the silly questions here, but is Gc 
> supposed to
>   segfault under valgrind ?
> 
>   In fact I have trouble with a (rather complex) Gc program which
>   segfaults when I'm compiling with gcc-3.4 but not when I'm compiling
>   with gcc-3.3
> 
>   On my way to downsizing the problem, I got that the thing did not
>   segfault by itself, but only when monitored by valgrind.
> 
>   And I came to the point that the most simple example does segfault
>   under valgrind, and does so using gcc-3.3 too...
> 
>   I'm using gc6.8, almost forgot to mention that I'm doing my tests
>   with debian sarge on an AMD Sempron, and by "most simple example",
>   I mean the following:
> 
>   #include <gc.h>
> 
>   int main(void)
>   {
>     void *p;
> 
>     GC_init();
> 
>     p=GC_malloc(150);
> 
>     return 0;
>   }
> 
>   I'm appending the valgrind output as an attachment.
> 
>   Is the segfault under valgrind something to expect ?
> 
>   And then should I try to downsize while keeping the 
> standalone segfault ?
> 
>   Last remark: I love to turn on -Wall -Wstrict-prototypes, and of
>   course tried that on Gc... Was a bad move, especially for 
> prototypes...
> 
> --
>   Eric Deplagne
> 



More information about the Gc mailing list