Author: Dave Gomboc
Date: 16:41:29 10/25/03
Go up one level in this thread
On October 25, 2003 at 09:49:58, Tord Romstad wrote: >I use the gcc (version 3.2) included with the Cygwin tools to compile the >Windows version >of my engine. The last month or so, the Windows version has had a mysterious >problem: >When compiled with the -fbranch-prediction flag, it consistently crashed at move >109 or >110 when running in UCI mode. The problem never occured in Winboard mode, it >never >occured in either UCI or Winboard mode in Linux or MacOS X, and it disappeared >when >I compiled without -fbranch-prediction (but this makes the engine much slower). > >After spending a few hours debugging, I found that the crash occurs in the >following >innocent-looking function: > >void uci_wait_for_command() { > char command[10000]; > > fgets(command, 10000, stdin); > uci_handle_command(command); } > >It is the call to fgets which causes the crash. The reason why the problem >occures at >move 109 or 110 is probably because the string sent by the GUI with the >"position" >command gets very long (though nowhere near 10000 characters) after so many >moves. > >Increasing the size of the command[] array did not have any effect. However, >when I >changed the command[] array to a global variable, the crashes suddenly >disappeared. > >Is this likely to be a bug in gcc, or could it be caused by a bug somewhere else >in >my source code? > >Tord I'd suspect a bug in your code, but of course it's hard to say for sure. Try bumping up your stack size. Try valgrind (http://developer.kde.org/~sewardj/). Dave
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.