gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] Uninitialized conditional jump


From: bump
Subject: Re: [gnugo-devel] Uninitialized conditional jump
Date: Fri, 1 Oct 2004 06:55:44 -0700

> > Since Valgrind complained at line 290 but not at the earlier
> > line 285, I infer that goal[pos] is initialized but
> > goal[pos+delta[j]] is not. So this must be some problem
> > at the edge of the board.
>
> It is, more specifically at the bottom edge of the board. (goal is
> initialized up to BOARDMAX but neighbors off the bottom edge of the
> board have values between BOARDMAX and BOARDSIZE.) Try changing line
> 290 to
>
>       if (ON_BOARD(pos + delta[j]) && goal[pos + delta[j]])
>

Of course that worked. Now in the CVS for both branches.

I'll continue valgrinding.

Dan


Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnugo/gnugo/ChangeLog,v
retrieving revision 1.798.2.13
diff -u -r1.798.2.13 ChangeLog
--- ChangeLog        27 Sep 2004 20:04:29 -0000 1.798.2.13
+++ ChangeLog        1 Oct 2004 13:27:33 -0000
@@ -2,6 +2,7 @@
 -- ChangeLog
 -------------------------------------------------------------------------
 
+- bugfix in break_in_goal_from_str(): check pos+delta on board
 - bugfix in test_owl_attack_move()
 - bugfix in resignation-allowed configure option
 
Index: engine/breakin.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/breakin.c,v
retrieving revision 1.14
diff -u -r1.14 breakin.c
--- engine/breakin.c    24 Jan 2004 04:04:56 -0000      1.14
+++ engine/breakin.c    1 Oct 2004 13:27:48 -0000
@@ -287,7 +287,7 @@
   goal[pos] = 0;
       }
       for (j = 0; j < 4; j++)
-      if (goal[pos + delta[j]])
+      if (ON_BOARD(pos + delta[j]) && goal[pos + delta[j]])
         affected_size++;
       /* Don't kill too much territory at a time. */
       if (affected_size >= 5) {




reply via email to

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