[Gc] GC_INIT vs valgrind on Fedora 14

Jim Meyering jim at meyering.net
Tue Dec 21 07:20:02 PST 2010


Use this trivial file:

    #include "gc.h"
    int main () { GC_INIT (); return 0; }

Compile/link it, and it runs fine on Fedora 14, with gc-devel
(both gc-devel-7.2-0.1.alpha4.fc13.i686
 and gc-devel-7.2-0.1.alpha4.fc13.x86_64)

    $ printf '#include "gc.h"\nint main(){GC_INIT();return 0;}' > k.c
    $ gcc -W -Wall k.c -lgc && ./a.out && echo ok
    ok

But when I run it under valgrind-3.5.0, it segfaults:

    $ valgrind ./a.out >& k
    zsh: segmentation fault (core dumped)  valgrind ./a.out >&k
    [Exit 139 (SEGV)]

At this point I guess it could be gc, valgrind or F14/glibc-specific.
I don't know.

Any explanation or work-around suggestion would be most welcome...

FYI, here's the output of valgrind on x86_64:

==11807== Memcheck, a memory error detector
==11807== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==11807== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
==11807== Command: ./a.out
==11807==
==11807== Conditional jump or move depends on uninitialised value(s)
==11807==    at 0x3036415BF6: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641FFAA: GC_with_callee_saves_pushed (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x30364179CE: GC_push_roots (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==
==11807== Conditional jump or move depends on uninitialised value(s)
==11807==    at 0x3036415BFB: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641FFAA: GC_with_callee_saves_pushed (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x30364179CE: GC_push_roots (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==
==11807== Use of uninitialised value of size 8
==11807==    at 0x3036415A30: GC_mark_and_push_stack (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036415C01: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641FFAA: GC_with_callee_saves_pushed (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x30364179CE: GC_push_roots (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==
==11807== Conditional jump or move depends on uninitialised value(s)
==11807==    at 0x3036415A3F: GC_mark_and_push_stack (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036415C01: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641FFAA: GC_with_callee_saves_pushed (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x30364179CE: GC_push_roots (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==
==11807== Use of uninitialised value of size 8
==11807==    at 0x3036415A72: GC_mark_and_push_stack (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036415C01: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641FFAA: GC_with_callee_saves_pushed (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x30364179CE: GC_push_roots (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==
==11807== Use of uninitialised value of size 8
==11807==    at 0x3036413326: GC_find_header (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640F4D2: GC_add_to_black_list_stack (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036415C01: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641FFAA: GC_with_callee_saves_pushed (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x30364179CE: GC_push_roots (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==
==11807== Conditional jump or move depends on uninitialised value(s)
==11807==    at 0x3036413335: GC_find_header (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640F4D2: GC_add_to_black_list_stack (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036415C01: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641FFAA: GC_with_callee_saves_pushed (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x30364179CE: GC_push_roots (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==
==11807== Use of uninitialised value of size 8
==11807==    at 0x303641335F: GC_find_header (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640F4D2: GC_add_to_black_list_stack (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036415C01: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641FFAA: GC_with_callee_saves_pushed (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x30364179CE: GC_push_roots (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==
==11807== Use of uninitialised value of size 8
==11807==    at 0x303640F512: GC_add_to_black_list_stack (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036415C01: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641FFAA: GC_with_callee_saves_pushed (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x30364179CE: GC_push_roots (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==
==11807== Conditional jump or move depends on uninitialised value(s)
==11807==    at 0x3036415BF6: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641F6CD: GC_push_all_stacks (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==
==11807== Conditional jump or move depends on uninitialised value(s)
==11807==    at 0x3036415BFB: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641F6CD: GC_push_all_stacks (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==
==11807== Use of uninitialised value of size 8
==11807==    at 0x3036415A30: GC_mark_and_push_stack (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036415C01: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641F6CD: GC_push_all_stacks (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==
==11807== Conditional jump or move depends on uninitialised value(s)
==11807==    at 0x3036415A3F: GC_mark_and_push_stack (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036415C01: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641F6CD: GC_push_all_stacks (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==
==11807== Use of uninitialised value of size 8
==11807==    at 0x3036415A72: GC_mark_and_push_stack (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036415C01: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641F6CD: GC_push_all_stacks (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==
==11807== Use of uninitialised value of size 8
==11807==    at 0x3036413326: GC_find_header (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640F4D2: GC_add_to_black_list_stack (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036415C01: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641F6CD: GC_push_all_stacks (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==
==11807== Conditional jump or move depends on uninitialised value(s)
==11807==    at 0x3036413335: GC_find_header (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640F4D2: GC_add_to_black_list_stack (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036415C01: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641F6CD: GC_push_all_stacks (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==
==11807== Use of uninitialised value of size 8
==11807==    at 0x303641335F: GC_find_header (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640F4D2: GC_add_to_black_list_stack (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036415C01: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641F6CD: GC_push_all_stacks (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==
==11807== Use of uninitialised value of size 8
==11807==    at 0x303640F512: GC_add_to_black_list_stack (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036415C01: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641F6CD: GC_push_all_stacks (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==
==11807== Invalid read of size 8
==11807==    at 0x3036415BF0: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641F6CD: GC_push_all_stacks (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==  Address 0x7ff001000 is not stack'd, malloc'd or (recently) free'd
==11807==
==11807==
==11807== Process terminating with default action of signal 11 (SIGSEGV)
==11807==  Access not within mapped region at address 0x7FF001000
==11807==    at 0x3036415BF0: GC_push_all_eager (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641F6CD: GC_push_all_stacks (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303641734B: GC_mark_some (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E6A7: GC_stopped_mark (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x303640E969: GC_try_to_collect_inner (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x3036419881: GC_init (in /usr/lib64/libgc.so.1.0.3)
==11807==    by 0x40060C: main (in /t/a.out)
==11807==  If you believe this happened as a result of a stack
==11807==  overflow in your program's main thread (unlikely but
==11807==  possible), you can try to increase the size of the
==11807==  main thread stack using the --main-stacksize= flag.
==11807==  The main thread stack size used in this run was 8388608.
==11807==
==11807== HEAP SUMMARY:
==11807==     in use at exit: 0 bytes in 0 blocks
==11807==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==11807==
==11807== All heap blocks were freed -- no leaks are possible
==11807==
==11807== For counts of detected and suppressed errors, rerun with: -v
==11807== Use --track-origins=yes to see where uninitialised values come from
==11807== ERROR SUMMARY: 606 errors from 19 contexts (suppressed: 6 from 6)


More information about the Gc mailing list