gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] I stepped on a bug


From: Felix C. Stegerman
Subject: Re: [gnugo-devel] I stepped on a bug
Date: Thu, 06 Oct 2005 17:01:50 +0200
User-agent: Debian Thunderbird 1.0.7 (X11/20051001)

Gunnar Farnebäck wrote:
> Felix wrote:
> 
>>I can indeed reproduce the bug.
> That's good. Then we have a reasonable chance to track it down.
<snip>
> Ah, no, the backtrace we ask for is something different.
> Usually you would do like this:
> gdb gnugo
> run
> <play as usual until crash>
> bt
<snip>
> Now you should have a binary in interface/gnugo and can continue with
> the backtrace instructions, starting with "gdb interface/gnugo".
> /Gunnar

Ah, that kind of backtrace. I haven't used gdb (or any other debugger)
before, even though I'm an occasional C/C++/Perl programmer.

I've attached a log of the backtrace. I also attached a log of the
errors and warnings (everything sent to STDERR) during make.

I found that the compile log contained errors like this one:
owl.c:4867: warning: comparison is always true due to limited range of
data type

The same errors can be found in the debian build log for PPC:
http://buildd.debian.org/build.php?pkg=gnugo

I also compiled the same source on Mac OS X (running in MOL on the
same Mac Mini), which did not result in the same errors.

The problem seems to be signedness. I edited owl.c and changed char to
signed char on lines 221, 4639, 4727, 4728 and 4863. Then I recompiled
gnugo. After that a quick test seems to indicate the bug is gone.
This fix is probable a bit to simple, and I haven't read the entire
code (or even the entire file owl.c), but this should help you fix it.

I'd appreciate it if you'd let me know whether this signedness problem
 is a bug in gnugo or in gcc. I'm not sure whether chars are meant to
be signed or unsigned by default

Regards,


Felix

-- 
Felix C. Stegerman <address@hidden>

"Any sufficiently advanced bug is indistiguishable from a feature."
 -- R. Kulawiec
$ gdb interface/gnugo
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "powerpc-linux"...Using host libthread_db library 
"/lib/tls/libthread_db.so.1".

(gdb) run
Starting program: /data/felix/tmp/gnugo/gnugo-3.7.5/interface/gnugo
GNU Go 3.7.5
Copyright 1999, 2000, 2001, 2002, 2003, 2004 and 2005 by the Free Software
Foundation, Inc. See http://www.gnu.org/software/gnugo/ or contact
address@hidden for information about GNU Go. GNU Go comes with NO WARRANTY to
the extent permitted by law. This program is free software; you can
redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation - version 2.  For more
information about these matters, see the files named COPYING.

Beginning ASCII mode game.

Board Size:   19
Handicap      0
Komi:         0.0
Move Number:  0
To Move:      black
Computer player: White

    White (O) has captured 0 pieces
    Black (X) has captured 0 pieces

    A B C D E F G H J K L M N O P Q R S T
 19 . . . . . . . . . . . . . . . . . . . 19
 18 . . . . . . . . . . . . . . . . . . . 18
 17 . . . . . . . . . . . . . . . . . . . 17
 16 . . . + . . . . . + . . . . . + . . . 16
 15 . . . . . . . . . . . . . . . . . . . 15
 14 . . . . . . . . . . . . . . . . . . . 14
 13 . . . . . . . . . . . . . . . . . . . 13
 12 . . . . . . . . . . . . . . . . . . . 12
 11 . . . . . . . . . . . . . . . . . . . 11
 10 . . . + . . . . . + . . . . . + . . . 10
  9 . . . . . . . . . . . . . . . . . . .  9
  8 . . . . . . . . . . . . . . . . . . .  8
  7 . . . . . . . . . . . . . . . . . . .  7
  6 . . . . . . . . . . . . . . . . . . .  6
  5 . . . . . . . . . . . . . . . . . . .  5
  4 . . . + . . . . . + . . . . . + . . .  4
  3 . . . . . . . . . . . . . . . . . . .  3
  2 . . . . . . . . . . . . . . . . . . .  2
  1 . . . . . . . . . . . . . . . . . . .  1
    A B C D E F G H J K L M N O P Q R S T

black(1): c4

    White (O) has captured 0 pieces
    Black (X) has captured 0 pieces

    A B C D E F G H J K L M N O P Q R S T        Last move: Black C4
 19 . . . . . . . . . . . . . . . . . . . 19
 18 . . . . . . . . . . . . . . . . . . . 18
 17 . . . . . . . . . . . . . . . . . . . 17
 16 . . . + . . . . . + . . . . . + . . . 16
 15 . . . . . . . . . . . . . . . . . . . 15
 14 . . . . . . . . . . . . . . . . . . . 14
 13 . . . . . . . . . . . . . . . . . . . 13
 12 . . . . . . . . . . . . . . . . . . . 12
 11 . . . . . . . . . . . . . . . . . . . 11
 10 . . . + . . . . . + . . . . . + . . . 10
  9 . . . . . . . . . . . . . . . . . . .  9
  8 . . . . . . . . . . . . . . . . . . .  8
  7 . . . . . . . . . . . . . . . . . . .  7
  6 . . . . . . . . . . . . . . . . . . .  6
  5 . . . . . . . . . . . . . . . . . . .  5
  4 . .(X)+ . . . . . + . . . . . + . . .  4
  3 . . . . . . . . . . . . . . . . . . .  3
  2 . . . . . . . . . . . . . . . . . . .  2
  1 . . . . . . . . . . . . . . . . . . .  1
    A B C D E F G H J K L M N O P Q R S T

GNU Go is thinking...
white(2): Q4

    White (O) has captured 0 pieces
    Black (X) has captured 0 pieces

    A B C D E F G H J K L M N O P Q R S T        Last move: White Q4
 19 . . . . . . . . . . . . . . . . . . . 19
 18 . . . . . . . . . . . . . . . . . . . 18
 17 . . . . . . . . . . . . . . . . . . . 17
 16 . . . + . . . . . + . . . . . + . . . 16
 15 . . . . . . . . . . . . . . . . . . . 15
 14 . . . . . . . . . . . . . . . . . . . 14
 13 . . . . . . . . . . . . . . . . . . . 13
 12 . . . . . . . . . . . . . . . . . . . 12
 11 . . . . . . . . . . . . . . . . . . . 11
 10 . . . + . . . . . + . . . . . + . . . 10
  9 . . . . . . . . . . . . . . . . . . .  9
  8 . . . . . . . . . . . . . . . . . . .  8
  7 . . . . . . . . . . . . . . . . . . .  7
  6 . . . . . . . . . . . . . . . . . . .  6
  5 . . . . . . . . . . . . . . . . . . .  5
  4 . . X + . . . . . + . . . . .(O). . .  4
  3 . . . . . . . . . . . . . . . . . . .  3
  2 . . . . . . . . . . . . . . . . . . .  2
  1 . . . . . . . . . . . . . . . . . . .  1
    A B C D E F G H J K L M N O P Q R S T

black(3): r4

    White (O) has captured 0 pieces
    Black (X) has captured 0 pieces

    A B C D E F G H J K L M N O P Q R S T        Last move: Black R4
 19 . . . . . . . . . . . . . . . . . . . 19
 18 . . . . . . . . . . . . . . . . . . . 18
 17 . . . . . . . . . . . . . . . . . . . 17
 16 . . . + . . . . . + . . . . . + . . . 16
 15 . . . . . . . . . . . . . . . . . . . 15
 14 . . . . . . . . . . . . . . . . . . . 14
 13 . . . . . . . . . . . . . . . . . . . 13
 12 . . . . . . . . . . . . . . . . . . . 12
 11 . . . . . . . . . . . . . . . . . . . 11
 10 . . . + . . . . . + . . . . . + . . . 10
  9 . . . . . . . . . . . . . . . . . . .  9
  8 . . . . . . . . . . . . . . . . . . .  8
  7 . . . . . . . . . . . . . . . . . . .  7
  6 . . . . . . . . . . . . . . . . . . .  6
  5 . . . . . . . . . . . . . . . . . . .  5
  4 . . X + . . . . . + . . . . . O(X). .  4
  3 . . . . . . . . . . . . . . . . . . .  3
  2 . . . . . . . . . . . . . . . . . . .  2
  1 . . . . . . . . . . . . . . . . . . .  1
    A B C D E F G H J K L M N O P Q R S T

GNU Go is thinking...


***assertion failure:
owl.c:4667 - num_components > 0 near PASS***

W:R5 B:R3 W:P4 B:S5 W:R6 B:S6 W:R2 B:R7 W:S8
   A B C D E F G H J K L M N O P Q R S T
19 . . . . . . . . . . . . . . . . . . . 19
18 . . . . . . . . . . . . . . . . . . . 18
17 . . . . . . . . . . . . . . . . . . . 17
16 . . . + . . . . . + . . . . . + . . . 16
15 . . . . . . . . . . . . . . . . . . . 15
14 . . . . . . . . . . . . . . . . . . . 14
13 . . . . . . . . . . . . . . . . . . . 13
12 . . . . . . . . . . . . . . . . . . . 12
11 . . . . . . . . . . . . . . . . . . . 11     WHITE (O) has captured 0 stones
10 . . . + . . . . . + . . . . . + . . . 10     BLACK (X) has captured 0 stones
 9 . . . . . . . . . . . . . . . . . . . 9
 8 . . . . . . . . . . . . . . . . . O . 8
 7 . . . . . . . . . . . . . . . . X . . 7
 6 . . . . . . . . . . . . . . . . O X . 6
 5 . . . . . . . . . . . . . . . . O X . 5
 4 . . X + . . . . . + . . . . O O X . . 4
 3 . . . . . . . . . . . . . . . . X . . 3
 2 . . . . . . . . . . . . . . . . O . . 2
 1 . . . . . . . . . . . . . . . . . . . 1
   A B C D E F G H J K L M N O P Q R S T
(;GM[1]FF[4]SZ[19]KM[0.0]GN[GNU Go 3.7.5 stepped on a bug]
;B[cp];W[pp];B[qp]
)
gnugo 3.7.5 (seed 1128606855): You stepped on a bug.
Please mail this message, including the debug output above, to address@hidden


Program received signal SIGABRT, Aborted.
0x0fe3b590 in raise () from /lib/tls/libc.so.6
(gdb) bt
#0  0x0fe3b590 in raise () from /lib/tls/libc.so.6
#1  0x0fe3cf8c in abort () from /lib/tls/libc.so.6
#2  0x10053874 in abortgo (file=Variable "file" is not available.
) at printutils.c:296
#3  0x10049ee0 in do_owl_attack (str=271581184, move=0x0, wormid=0x7fb08a20,
    owl=0x1053c5b8, escape=2) at owl.c:4667
#4  0x10048bb4 in do_owl_defend (str=337, move=0x0, wormid=0x7fb09490,
    owl=0x105332d0, escape=2) at owl.c:2677
#5  0x10049f04 in do_owl_attack (str=337, move=0x0, wormid=0x7fb09f30,
    owl=0x10529f80, escape=2) at owl.c:2106
#6  0x10048bb4 in do_owl_defend (str=337, move=0x0, wormid=0x7fb0a9a0,
    owl=0x10520ce8, escape=1) at owl.c:2677
#7  0x10049f04 in do_owl_attack (str=337, move=0x0, wormid=0x7fb0b440,
    owl=0x105179c8, escape=1) at owl.c:2106
#8  0x10048bb4 in do_owl_defend (str=337, move=0x0, wormid=0x7fb0beb0,
    owl=0x1050e728, escape=1) at owl.c:2677
#9  0x10049f04 in do_owl_attack (str=337, move=0x0, wormid=0x7fb0c950,
    owl=0x105054f8, escape=1) at owl.c:2106
#10 0x10048bb4 in do_owl_defend (str=337, move=0x0, wormid=0x7fb0d3c0,
    owl=0x104fc260, escape=0) at owl.c:2677
#11 0x10049f04 in do_owl_attack (str=337, move=0x7fb0de50, wormid=0x7fb0de58,
    owl=0x104f2fa8, escape=0) at owl.c:2106
#12 0x1004f910 in owl_attack (target=337, attack_point=0x7fb0deb0,
    certain=0x104f199c, kworm=0x7fb0dea8) at owl.c:1737
#13 0x100291a8 in make_dragons (stop_before_owl=0) at dragon.c:229
#14 0x1002ab7c in examine_position (how_much=99) at genmove.c:151
#15 0x1002b094 in do_genmove (color=337, pure_threat_value=0.400000006,
    allowed_moves=0x0, value=0x104132c8, resign=0x10300000) at genmove.c:347
#16 0x1002be70 in genmove (color=Variable "color" is not available.
) at genmove.c:245
#17 0x1003337c in gnugo_genmove (i=0x7fb0f888, j=0x7fb0f88c, color=Variable 
"color" is not available.
)
    at interface.c:293
#18 0x10004794 in computer_move (gameinfo=0x7fb0ffec, passes=0x7fb0f914)
    at play_ascii.c:467
#19 0x10004a94 in do_move (gameinfo=0x7fb0ffec, command=Variable "command" is 
not available.
) at play_ascii.c:542
#20 0x10004fe8 in play_ascii (tree=0x7fb0ffdc, gameinfo=0x7fb0ffec, 
filename=Variable "filename" is not available.
)
    at play_ascii.c:819
#21 0x1000238c in main (argc=1, argv=0x7fb142e4) at main.c:1436
(gdb) q
The program is running.  Exit anyway? (y or n) y
owl.c: In function 'connected_components':
owl.c:4652: warning: comparison is always false due to limited range of data 
type
owl.c:4660: warning: comparison is always false due to limited range of data 
type
owl.c: In function 'componentdump':
owl.c:4867: warning: comparison is always true due to limited range of data type
---------------------------
DFA for aa_attackpat
size: 3 kB for 26 patterns (340 states)
---------------------------
---------------------------
DFA for owl_attackpat
size: 93 kB for 394 patterns (9363 states)
---------------------------
---------------------------
DFA for owl_vital_apat
size: 10 kB for 56 patterns (1004 states)
---------------------------
---------------------------
DFA for owl_defendpat
size: 117 kB for 489 patterns (11853 states)
---------------------------
uncompress_fuseki.c: In function 'main':
uncompress_fuseki.c:269: warning: pointer targets in passing argument 2 of 
'set_boards' differ in signedness
uncompress_fuseki.c:274: warning: pointer targets in passing argument 2 of 
'set_boards' differ in signedness
---------------------------
corner database for joseki
size: 179 kB for 1622 patterns (8673 variations)
---------------------------

reply via email to

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