mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08:00
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 <mcostalba@gmail.com>
This commit is contained in:
committed by
Marco Costalba
parent
c83fd08fd4
commit
32bd6e44f0
@@ -54,7 +54,7 @@ namespace {
|
|||||||
// The root position. This is set up when the user (or in practice, the GUI)
|
// 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()
|
// sends the "position" UCI command. The root position is sent to the think()
|
||||||
// function when the program receives the "go" command.
|
// function when the program receives the "go" command.
|
||||||
Position RootPosition(StartPosition);
|
Position RootPosition;
|
||||||
|
|
||||||
// Local functions
|
// Local functions
|
||||||
bool handle_command(const string& command);
|
bool handle_command(const string& command);
|
||||||
|
|||||||
Reference in New Issue
Block a user