]> git.sesse.net Git - stockfish/commitdiff
Fix stack initialization
authormstembera <MissingEmail@email>
Wed, 28 Dec 2022 00:44:32 +0000 (16:44 -0800)
committerStéphane Nicolet <cassio@free.fr>
Wed, 4 Jan 2023 08:37:02 +0000 (09:37 +0100)
This fixes a bug where on line 278 the Stack::staticEvals are
initialized to 0. However VALUE_NONE is defined to be 32002 so
this is a bug in master. It is probably due to the calculation
of improvement, where staticEval prior to rootPos can be accessed.

https://tests.stockfishchess.org/tests/view/63ab91cf39af998100ce1666
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 53736 W: 14285 L: 13955 D: 25496
Ptnml(0-2): 121, 5921, 14500, 6159, 167

https://tests.stockfishchess.org/tests/view/63b2af5ee28ed36c814bed52
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 33776 W: 9130 L: 8934 D: 15712
Ptnml(0-2): 14, 3240, 10185, 3434, 15

closes https://github.com/official-stockfish/Stockfish/pull/4320

Bench: 4068510

src/search.cpp

index d0ed44fa16a8c34ebc5e1648bd93ff6b580f558c..d27b21d2cb8b53e3e77a84e4d147bc1415c2cea8 100644 (file)
@@ -276,8 +276,11 @@ void Thread::search() {
   int iterIdx = 0;
 
   std::memset(ss-7, 0, 10 * sizeof(Stack));
-  for (int i = 7; i > 0; i--)
+  for (int i = 7; i > 0; --i)
+  {
       (ss-i)->continuationHistory = &this->continuationHistory[0][0][NO_PIECE][0]; // Use as a sentinel
+      (ss-i)->staticEval = VALUE_NONE;
+  }
 
   for (int i = 0; i <= MAX_PLY + 2; ++i)
       (ss+i)->ply = i;