This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

I suspect a serious bug



Consider the following program:

#include <guile/gh.h>
#include <stdlib.h>

static void
inner_main (void *closure, int argc, char **argv)
{
  int N = atoi(argv[1]);
  SCM res;
  double * U = calloc(N, sizeof(double));
  int i;

  for (i = 0; i < N; ++i) {
    U[i] = i + 0.5;
  }
  gh_eval_str("(display \"Strange\n\")");
  res = gh_doubles2scm(U, N);
  gh_display(gh_vector_ref(res, gh_int2scm(0)));
  gh_newline();
  gh_display(gh_vector_ref(res, gh_int2scm(N-1)));
  gh_newline();
}

int
main (int argc, char **argv)
{
  scm_boot_guile (argc, argv, inner_main, 0);
  return 0; /* never reached */
}

This produces the following output:
$ for i in 500 5000 50000 500000
> do
> a.out $i
> a.out $i
> done
Strange
0.5
499.5
Strange
0.5
499.5
Strange
#<freed cell 31980; GC missed a reference>
4999.5
Strange
#<freed cell 321c8; GC missed a reference>
4999.5
Strange
48196.5
49999.5
Strange
48197.5
49999.5
Strange
494129.5
499999.5
Strange
494129.5
499999.5
$ gcc --version
egcs-2.90.29 980515 (egcs-1.0.3 release)
$ uname -a
SunOS min 5.6 Generic_105181-05 sun4u sparc SUNW,Ultra-5_10
$ guile --version
Guile 1.3.4
Copyright (c) 1995, 1996, 1997 Free Software Foundation
Guile may be distributed under the terms of the GNU General Public Licence;
certain other uses are permitted as well.  For details, see the file
`COPYING', which is included in the Guile distribution.
There is no warranty, to the extent permitted by law.
$ 

Notice in particular that successive runs with the same argument
50000 are not reproductible.

Can you reproduce these results on other machines ?

-- 

B. Urban

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]