gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnugo-devel] Re: 3.5.4 on Tru64: assertion failure in ld_owl


From: Gunnar Farneback
Subject: Re: [gnugo-devel] Re: 3.5.4 on Tru64: assertion failure in ld_owl
Date: Sun, 08 Feb 2004 01:45:33 +0100
User-agent: EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.7 (sparc-sun-solaris2.7) (with unibyte mode)

Teun wrote:
> Paul wrote:
> > This must be solvable with `configure' script.  There is
> > a AC_FUNC_MALLOC() macro.  However, maybe it is easier to
> > alter the code.
> > 
> > I can work on Autoconf-based solution.  Let me know if it
> > is what we would like.
> 
> I would prefer a non-autoconf solution.

Me too. Actually I don't see how autoconf would help us at all since
we in any case need code to handle the case of 0 byte allocation.

> A quick solution is something like the following (basically the
> same as suggested in the autoconf info):
> 
> Code avoiding a malloc call for the case list->counter == 0
> would perhaps be better.

Absolutely. Does the patch below solve the problem correctly?

/Gunnar

Index: engine/owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.198
diff -u -r1.198 owl.c
--- engine/owl.c        5 Feb 2004 22:54:42 -0000       1.198
+++ engine/owl.c        8 Feb 2004 00:43:20 -0000
@@ -3867,9 +3867,11 @@
   int k;
   int limit;
 
-  list->pattern_heap = malloc(list->counter
-                             * sizeof(struct matched_pattern_data*));
-  gg_assert(list->pattern_heap != NULL);
+  if (list->counter > 0) {
+    list->pattern_heap = malloc(list->counter
+                               * sizeof(struct matched_pattern_data*));
+    gg_assert(list->pattern_heap != NULL);
+  }
 
   for (k = 0; k < list->counter; k++) {
 #if USE_BDIST




reply via email to

[Prev in Thread] Current Thread [Next in Thread]