[Gc] Re: gc 6.1 on mac os x

Daniel R. Grayson dan at math.uiuc.edu
Wed Feb 18 10:42:12 PST 2009


A test program of mine fails with gc 7.1 on the Power PC under Mac OS 10.4,
unless threads are disabled, even though "make check" passes all the tests.  (I
thought my test routine was going to be included.)

Here are the results with the uninteresting lines of output removed:

    $ uname -a
    Darwin cesium.local 8.11.0 Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC Power Macintosh powerpc

okay:

    $ ../../configure --disable-threads --prefix=`pwd`/install

not okay:

    $ ../../configure --prefix=`pwd`/install

      or

    $ ../../configure --enable-threads=posix --enable-parallel-mark --prefix=`pwd`/install

    $ make
    $ make install
    $ gcc -g ../testgc.c -Iinstall/include -Linstall/lib -lgc
    $ ./a.out
	Bus error
    $ gdb a.out
	Program received signal EXC_BAD_ACCESS, Could not access memory.
	Reason: KERN_PROTECTION_FAILURE at address: 0x00000008
	GC_generic_malloc_many (lb=16, k=1, result=0xa000ee14) at ../../mallocx.c:306
	306	    	while ((hbp = *rlh) != 0) {
	(gdb) where
	#0  GC_generic_malloc_many (lb=16, k=1, result=0xa000ee14) at ../../mallocx.c:306
	#1  0x0008266c in GC_generic_malloc_many (lb=16, k=1, result=0xa000ee14) at ../../mallocx.c:291
	warning: Previous frame identical to this frame (corrupt stack?)
	#2  0x0008a188 in GC_malloc (bytes=12) at ../../thread_local_alloc.c:176
	#3  0x000028f0 in main () at ../testgc.c:26
	(gdb) p rlh
	$1 = (struct hblk **) 0x0
    $ make check
	All 6 tests passed
    $ 

Let me know if I can help further.

--
              Daniel R. Grayson, Professor (retired, Emeritus)
              Department of Mathematics
              University of Illinois at Urbana-Champaign
        www:  http://www.math.uiuc.edu/~dan/
      email:  dan at math.uiuc.edu
    us mail:  2409 S. Vine St., Urbana, IL 61801, USA
      phone:  +1-217-367-6384 home (88.20224W, 40.08541N)
 cell phone:  +1-217-377-0458


=============================================================================

    $ cat ../testgc.c 
    /* we test gc to whether it properly marks pointers found in registers */

    #include <gc/gc.h>
    #include <stdarg.h>
    #include <stdio.h>
    #include <stdlib.h>

    static void uniq(void *p, ...) {
      va_list a;
      void *q[100];
      int n = 0, i, j;
      q[n++] = p;
      va_start(a,p);
      for (;(q[n] = va_arg(a,void *));n++) ;
      va_end(a);
      for (i=0; i<n; i++) for (j=0; j<i; j++) if (q[i] == q[j]) {
	fprintf(stderr,
		"error: gc library doesn't find all the active pointers!\n"
		"       Perhaps GC_push_regs was configured incorrectly.\n"
		);
	exit(1);
      }
    }

    int main () {
      uniq(
	   GC_malloc(12), GC_malloc(12), GC_malloc(12), (GC_gcollect(),GC_malloc(12)),
	   GC_malloc(12), GC_malloc(12), GC_malloc(12), (GC_gcollect(),GC_malloc(12)),
	   GC_malloc(12), GC_malloc(12), GC_malloc(12), (GC_gcollect(),GC_malloc(12)),
	   GC_malloc(12), GC_malloc(12), GC_malloc(12), (GC_gcollect(),GC_malloc(12)),
	   GC_malloc(12), GC_malloc(12), GC_malloc(12), (GC_gcollect(),GC_malloc(12)),
	   (void *)0);
      return 0;
    }

=============================================================================

> From: "Boehm, Hans" <hans_boehm at hp.com>
> To: "'dan at math.uiuc.edu'" <dan at math.uiuc.edu>
> Cc: "Boehm, Hans" <hans_boehm at hp.com>
> Subject: RE: gc 6.1 on mac os x
> Date: Mon, 2 Jun 2003 12:06:03 -0700 
> 
> Dan -
> 
> The MacOSX code is heavily revised in 6.2alpha5, and again in 6.2alpha6,
> which I'm about to release.  Thread support was added, etc.
> 
> If you don't mind, I'd like to just add your test program to gctest.
> I agree that this should be explicitly tested.  I'd rather not put tests
> in the regular build process.  "Make check" or "make test" is cheap enough
> that it should be run whenever there is any doubt.


More information about the Gc mailing list