From: Tom Vijlbrief Date: Mon, 19 Aug 2013 14:53:06 +0000 (+0200) Subject: Fix crash when reaching max ply X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=f45eee318bbe0fe1465bda80bf62bc8b3bc7d07c Fix crash when reaching max ply Bug introduced in 1b7223a53c419212efbd that updated the ss base stack without increasing the dimension. No functional change. --- diff --git a/src/search.cpp b/src/search.cpp index 72abae26..2a7cde2b 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -303,7 +303,7 @@ namespace { void id_loop(Position& pos) { - Stack stack[MAX_PLY_PLUS_3], *ss = stack+2; // To allow referencing (ss-2) + Stack stack[MAX_PLY_PLUS_6], *ss = stack+2; // To allow referencing (ss-2) int depth, prevBestMoveChanges; Value bestValue, alpha, beta, delta; @@ -1575,7 +1575,7 @@ moves_loop: // When in check and at SpNode search starts from here void RootMove::extract_pv_from_tt(Position& pos) { - StateInfo state[MAX_PLY_PLUS_3], *st = state; + StateInfo state[MAX_PLY_PLUS_6], *st = state; const TTEntry* tte; int ply = 0; Move m = pv[0]; @@ -1608,7 +1608,7 @@ void RootMove::extract_pv_from_tt(Position& pos) { void RootMove::insert_pv_in_tt(Position& pos) { - StateInfo state[MAX_PLY_PLUS_3], *st = state; + StateInfo state[MAX_PLY_PLUS_6], *st = state; const TTEntry* tte; int ply = 0; @@ -1683,7 +1683,7 @@ void Thread::idle_loop() { Threads.mutex.unlock(); - Stack stack[MAX_PLY_PLUS_3], *ss = stack+2; // To allow referencing (ss-2) + Stack stack[MAX_PLY_PLUS_6], *ss = stack+2; // To allow referencing (ss-2) Position pos(*sp->pos, this); std::memcpy(ss-2, sp->ss-2, 5 * sizeof(Stack)); diff --git a/src/types.h b/src/types.h index d7dfb7ad..86a86d19 100644 --- a/src/types.h +++ b/src/types.h @@ -90,7 +90,7 @@ typedef uint64_t Bitboard; const int MAX_MOVES = 192; const int MAX_PLY = 100; -const int MAX_PLY_PLUS_3 = MAX_PLY + 3; +const int MAX_PLY_PLUS_6 = MAX_PLY + 6; /// A move needs 16 bits to be stored ///