From: Joona Kiiski Date: Tue, 26 Jan 2010 18:22:51 +0000 (+0200) Subject: Do not initialize RootPosition at startup X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=32bd6e44f02a8e0c254376ab0791bd82a85d3cfe Do not initialize RootPosition at startup Initializing high-level object at startup is very dangerous, because low-level snippets are not yet initialized. For example Position's constructor calls find_checkers() which calls attackers_to() which depends on various global bitboard arrays which are not yet initialized. I think we are lucky not to crash. RootPosition.from_fen(StartPosition); is called immediately after all initializations are made at uci_main_loop() which is the correct behaviour Signed-off-by: Marco Costalba --- diff --git a/src/uci.cpp b/src/uci.cpp index 51eb15b6..6fa55912 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -54,7 +54,7 @@ namespace { // The root position. This is set up when the user (or in practice, the GUI) // sends the "position" UCI command. The root position is sent to the think() // function when the program receives the "go" command. - Position RootPosition(StartPosition); + Position RootPosition; // Local functions bool handle_command(const string& command);