]> git.sesse.net Git - stockfish/commitdiff
Fix crash when reaching max ply
authorTom Vijlbrief <tvijlbrief@gmail.com>
Mon, 19 Aug 2013 14:53:06 +0000 (16:53 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 19 Aug 2013 14:53:46 +0000 (16:53 +0200)
Bug introduced in 1b7223a53c419212efbd that
updated the ss base stack without increasing
the dimension.

No functional change.

src/search.cpp
src/types.h

index 72abae26a9d286f829fdfc9f2ac7053b14525cd2..2a7cde2b5fe848b7be3c778c263fc5d730da9a5b 100644 (file)
@@ -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));
index d7dfb7ad9feecb0f28cf8e0ec8aad55c3ccd9dc1..86a86d195ccf25b4e6f1f5ce3e6295c856bafa5d 100644 (file)
@@ -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
 ///