]> git.sesse.net Git - stockfish/commitdiff
Fix a 'value > VALUE_INFINITE' assert
authorMarco Costalba <mcostalba@gmail.com>
Sat, 27 Apr 2013 11:07:12 +0000 (13:07 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 27 Apr 2013 11:08:11 +0000 (13:08 +0200)
This fixes an assert while testing with debug on.

Assert was due to static null pruning returning value

eval - futility_margin(depth, (ss-1)->futilityMoveCount)

That was sometimes higher than VALUE_INFINITE triggering
an assert at the caller site.

Because eval con be equal to ttValue and anyhow is read from
TT that can be corrupted in SMP case, we need to sanity
check it before to use.

bench: 4176431

src/search.cpp

index cf640a0a90beb33e497474ea514b899d2f006b3b..6bdf255c3dafee03b8b2fff95536cc7a7405fba7 100644 (file)
@@ -646,6 +646,7 @@ namespace {
         && !inCheck
         &&  eval - futility_margin(depth, (ss-1)->futilityMoveCount) >= beta
         &&  abs(beta) < VALUE_MATE_IN_MAX_PLY
         && !inCheck
         &&  eval - futility_margin(depth, (ss-1)->futilityMoveCount) >= beta
         &&  abs(beta) < VALUE_MATE_IN_MAX_PLY
+        &&  abs(eval) < VALUE_KNOWN_WIN
         &&  pos.non_pawn_material(pos.side_to_move()))
         return eval - futility_margin(depth, (ss-1)->futilityMoveCount);
 
         &&  pos.non_pawn_material(pos.side_to_move()))
         return eval - futility_margin(depth, (ss-1)->futilityMoveCount);