Fix stockfish crash.

Merge commit 4e2bb8fa44fe03a2fdb2d3448ac93986354bf9ae from
https://github.com/official-stockfish.
This commit is contained in:
Peter Osterlund 2019-04-10 20:32:19 +02:00
parent 7c660323f0
commit 1fd3492edd

View File

@ -303,6 +303,7 @@ void MainThread::search() {
void Thread::search() {
Stack stack[MAX_PLY+7], *ss = stack+4; // To reference from (ss-4) to (ss+2)
Move pv[MAX_PLY+1];
Value bestValue, alpha, beta, delta;
Move lastBestMove = MOVE_NONE;
Depth lastBestMoveDepth = DEPTH_ZERO;
@ -314,6 +315,7 @@ void Thread::search() {
std::memset(ss-4, 0, 7 * sizeof(Stack));
for (int i = 4; i > 0; i--)
(ss-i)->continuationHistory = &this->continuationHistory[NO_PIECE][0]; // Use as sentinel
ss->pv = pv;
bestValue = delta = alpha = -VALUE_INFINITE;
beta = VALUE_INFINITE;
@ -758,8 +760,9 @@ namespace {
}
// Step 7. Razoring (~2 Elo)
if ( depth < 2 * ONE_PLY
&& eval <= alpha - RazorMargin)
if ( !rootNode // The required rootNode PV handling is not available in qsearch
&& depth < 2 * ONE_PLY
&& eval <= alpha - RazorMargin)
return qsearch<NT>(pos, ss, alpha, beta);
improving = ss->staticEval >= (ss-2)->staticEval