1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Pass moveCount by value in split()

Actually it is an error to update back moveCount value after split()
because it is used in update_history() to access movesSearched[]
array. But becasue this vector is not updated in the split point
we end up with an access of stale data.

Bug has been hidden til now because we 'forgot' to update
moveCount before returning from split().

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2010-10-12 09:54:01 +02:00
parent 00950fec00
commit 79a7647fe0

View file

@ -88,7 +88,7 @@ namespace {
template <bool Fake>
void split(const Position& pos, SearchStack* ss, int ply, Value* alpha, const Value beta, Value* bestValue,
Depth depth, Move threatMove, bool mateThreat, int* moveCount, MovePicker* mp, bool pvNode);
Depth depth, Move threatMove, bool mateThreat, int moveCount, MovePicker* mp, bool pvNode);
private:
friend void poll();
@ -1342,7 +1342,7 @@ namespace {
&& !ThreadsMgr.thread_should_stop(threadID)
&& Iteration <= 99)
ThreadsMgr.split<FakeSplit>(pos, ss, ply, &alpha, beta, &bestValue, depth,
threatMove, mateThreat, &moveCount, &mp, PvNode);
threatMove, mateThreat, moveCount, &mp, PvNode);
}
// Step 19. Check for mate and stalemate
@ -2560,7 +2560,7 @@ namespace {
template <bool Fake>
void ThreadsManager::split(const Position& p, SearchStack* ss, int ply, Value* alpha,
const Value beta, Value* bestValue, Depth depth, Move threatMove,
bool mateThreat, int* moveCount, MovePicker* mp, bool pvNode) {
bool mateThreat, int moveCount, MovePicker* mp, bool pvNode) {
assert(p.is_ok());
assert(ply > 0 && ply < PLY_MAX);
assert(*bestValue >= -VALUE_INFINITE);
@ -2600,7 +2600,7 @@ namespace {
splitPoint.pvNode = pvNode;
splitPoint.bestValue = *bestValue;
splitPoint.mp = mp;
splitPoint.moveCount = *moveCount;
splitPoint.moveCount = moveCount;
splitPoint.pos = &p;
splitPoint.parentSstack = ss;
for (i = 0; i < ActiveThreads; i++)