Passing the -ms option with any size argument to gij causes a segfault in the garbage collector: $ gdb --args gij -ms 56M Hello GNU gdb Red Hat Linux (6.3.0.0-0.29rh) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux-gnu"...(no debugging symbols found) Using host libthread_db library "/lib/tls/libthread_db.so.1". (gdb) r Starting program: /home/fitzsim/install/bin/gij -ms 56M Hello [Thread debugging using libthread_db enabled] [New Thread -1208486208 (LWP 12119)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1208486208 (LWP 12119)] 0x01729265 in GC_is_black_listed (h=0x11000, len=12288) at /home/fitzsim/sources/gcc/boehm-gc/blacklst.c:242 242 if (get_pht_entry_from_index(GC_old_normal_bl, index) (gdb) bt #0 0x01729265 in GC_is_black_listed (h=0x11000, len=12288) at /home/fitzsim/sources/gcc/boehm-gc/blacklst.c:242 #1 0x01726c6d in GC_allochblk_nth (sz=2054, kind=1, flags=0 '\0', n=16) at /home/fitzsim/sources/gcc/boehm-gc/allchblk.c:645 #2 0x01726a2a in GC_allochblk (sz=2054, kind=1, flags=0) at /home/fitzsim/sources/gcc/boehm-gc/allchblk.c:561 #3 0x0172da47 in GC_alloc_large (lw=2054, k=1, flags=0) at /home/fitzsim/sources/gcc/boehm-gc/malloc.c:53 #4 0x0172db40 in GC_alloc_large_and_clear (lw=2054, k=1, flags=0) at /home/fitzsim/sources/gcc/boehm-gc/malloc.c:86 #5 0x0172dd01 in GC_generic_malloc_inner (lb=8216, k=1) at /home/fitzsim/sources/gcc/boehm-gc/malloc.c:154 #6 0x01736e26 in GC_key_create (key_ptr=0x1ce6da0, destructor=0) at /home/fitzsim/sources/gcc/boehm-gc/specific.c:27 #7 0x0173859b in GC_init_thread_local (p=0x1cda460) at /home/fitzsim/sources/gcc/boehm-gc/pthread_support.c:224 #8 0x0173917e in GC_init_parallel () at /home/fitzsim/sources/gcc/boehm-gc/pthread_support.c:954 #9 0x017329ef in GC_init () at /home/fitzsim/sources/gcc/boehm-gc/misc.c:503 #10 0x0172c7df in GC_init_gcj_malloc (mp_index=0, mp=0x15a836c) at /home/fitzsim/sources/gcc/boehm-gc/gcj_mlc.c:60 #11 0x015a9c82 in _Jv_InitGC () at /home/fitzsim/sources/gcc/libjava/boehm.cc:627 #12 0x011648b7 in _Jv_CreateJavaVM (vm_args=0x0) at /home/fitzsim/sources/gcc/libjava/prims.cc:1092 #13 0x01164c89 in _Jv_RunMain (klass=0x0, name=0xbff97842 "Hello", argc=1, argv=0xbfee3cb0, is_jar=false) at /home/fitzsim/sources/gcc/libjava/prims.cc:1186 #14 0x00b83045 in main (argc=4, argv=0xbfee3ca4) at /home/fitzsim/sources/gcc/libjava/gij.cc:169 #15 0x0085cdb6 in __libc_start_main () from /lib/tls/libc.so.6 #16 0x08048461 in _start () (gdb)
The problem here is that _Jv_InitGC is called to late, and hence GC_all_interior_pointers is cleared after the GC has been run. This is documented not to work in gc.h. In particular _Jv_GCSetInitialHeapSize (which turns into GC_expand_hp) is called earlier. If things are always done in this order, it may make sense to have _Jv_GCSetInitialHeapSize just set a variable, and have _Jv_InitGC do the expansion. I'll be travelling next week, and thus won't get a chance to generate a patch soon.
Hans, are you still planning on creating a patch for this?
Closing as won't fix as libgcj (and the java front-end) has been removed from the trunk.