[Gc] Bigloo gcstd script crashes with mingw

Manuel Serrano Manuel.Serrano at sophia.inria.fr
Thu Sep 23 03:47:56 PDT 2004


> Can anyone tell me why the script (I've attached it
> to this email) in bigloo to determine if a standard GC 
> (--customgc=no)) crashes on Windows?
The current auto-configuration process incorrectly handles the custom GC. 
I have been able to fix this one. I will commit a new version by next Monday.

-- 
Manuel

ps: For your information, here is the fixed gcstd file:

=================== ~/prgm/project/bigloo/autoconf/gcstd ====================

-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----
#!/bin/sh
#*=====================================================================*/
#*    serrano/prgm/project/bigloo/autoconf/gcstd                       */
#*    -------------------------------------------------------------    */
#*    Author      :  Manuel Serrano                                    */
#*    Creation    :  Tue Jun 25 16:59:41 2002                          */
#*    Last change :  Thu Sep 23 12:47:30 2004 (serrano)                */
#*    Copyright   :  2002-04 Manuel Serrano                            */
#*    -------------------------------------------------------------    */
#*    This configure script checks that a standard GC installation     */
#*    is correct.                                                      */
#*=====================================================================*/

#*---------------------------------------------------------------------*/
#*    flags                                                            */
#*---------------------------------------------------------------------*/
cc=gcc
cflags=
tmp=/tmp
user=bigloo
gcdir=/usr/include/gc
gclib=gc
dlopenopt=

#*---------------------------------------------------------------------*/
#*    We parse the arguments                                           */
#*---------------------------------------------------------------------*/
while : ; do
  case $1 in
    "")
      break;;

    --user=*)
      user="`echo $1 | sed 's/^[-a-z]*=//'`";;

    --cc=*|-cc=*)
      cc="`echo $1 | sed 's/^[-a-z]*=//'`";;

    --cflags=*|-cflags=*)
      cflags="`echo $1 | sed 's/^[-a-z]*=//'`";;

    --tmp=*|-tmp=*)
      tmp="`echo $1 | sed 's/^[-a-z]*=//'`";;

    --gcdir=*)
      gcdir="`echo $1 | sed 's/^[-a-z]*=//'`";;

    --gclib=*)
      gclib="`echo $1 | sed 's/^[-a-z]*=//'`";;

    --dlopen=*)
      dlopen="`echo $1 | sed 's/^[-a-z]*=//'`";;

    -*)
      echo "Unknown option \"$1\", ignored" >&2;;
  esac
  shift
done

file=$tmp/actest$user
aout=$tmp/Xactest$user

#*---------------------------------------------------------------------*/
#*    compile                                                          */
#*---------------------------------------------------------------------*/
compile="$cc $cflags $file.c -o $aout -I$gcdir -l$gclib >/dev/null 2> /dev/null"
compile2="$cc $cflags $file.c -o $aout -I$gcdir -l$gclib $dlopen >/dev/null 2> /dev/null"

#*---------------------------------------------------------------------*/
#*    The test C file                                                  */
#*---------------------------------------------------------------------*/
if( test -f $file.c ); then
   \rm -f $file.c || exit $?
fi

#*---------------------------------------------------------------------*/
#*    Test                                                             */
#*---------------------------------------------------------------------*/
cat > $file.c <<EOF
#include <gc.h>
#include <gc_inl.h>

static double *
alloc_make_real( double d ) {
   double *real;

   real = (double *)GC_generic_malloc_words_small( sizeof( double ), PTRFREE );
   *real = d;
   
   return real;
}

double *
make_real ( double d ) {
   double *real;
   ptr_t op;
   ptr_t *opp;
   DCL_LOCK_STATE;
   
   opp = &(GC_aobjfreelist[ sizeof( double ) ]);

   FASTLOCK();

   if( !FASTLOCK_SUCCEEDED() || (op = *opp) == 0 ) {
      FASTUNLOCK();
      return alloc_make_real( d );
   } else {
      *opp = obj_link(op);
      GC_words_allocd += (sizeof( double ));
      FASTUNLOCK();

      real = (double *)op;
      *real = d;
      return real;
   }
}

int main( int argc, char *argv[] ) {
    double *d1, *d2;
    int i;

    GC_INIT();

    d1 = make_real( (double)1. );
    d2 = make_real( (double)3.14 );
    for( i = 0; i < 10000; i++ ) { 
       *d2 += *make_real( *d2 );
    }
    
    return (*d1 != 1.);
}
EOF

#*---------------------------------------------------------------------*/
#*    Compilation test                                                 */
#*---------------------------------------------------------------------*/
if eval $compile 2> /dev/null; then
   sh -c "rm -f $file.*" 2> /dev/null
   eval $aout
   \rm -f $aout
   echo "$gclib"
   exit 0
else
   if eval $compile2 2> /dev/null; then
      sh -c "rm -f $file.*" 2> /dev/null
      eval $aout
      \rm -f $aout
      echo "$gclib"
      exit 0
   else
      sh -c "rm -f $file.*" 2> /dev/null
      \rm -f $aout
      echo "Cannot compile gc checker, did you cp -R gcx.x/include/private to $gcdir ?" >&2
      exit 1
   fi
fi
-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----



More information about the Gc mailing list