Skip to content

Commit f45eee3

Browse files
tomtormcostalba
authored andcommitted
Fix crash when reaching max ply
Bug introduced in 1b7223a that updated the ss base stack without increasing the dimension. No functional change.
1 parent 8c2fd21 commit f45eee3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/search.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ namespace {
303303

304304
void id_loop(Position& pos) {
305305

306-
Stack stack[MAX_PLY_PLUS_3], *ss = stack+2; // To allow referencing (ss-2)
306+
Stack stack[MAX_PLY_PLUS_6], *ss = stack+2; // To allow referencing (ss-2)
307307
int depth, prevBestMoveChanges;
308308
Value bestValue, alpha, beta, delta;
309309

@@ -1575,7 +1575,7 @@ namespace {
15751575

15761576
void RootMove::extract_pv_from_tt(Position& pos) {
15771577

1578-
StateInfo state[MAX_PLY_PLUS_3], *st = state;
1578+
StateInfo state[MAX_PLY_PLUS_6], *st = state;
15791579
const TTEntry* tte;
15801580
int ply = 0;
15811581
Move m = pv[0];
@@ -1608,7 +1608,7 @@ void RootMove::extract_pv_from_tt(Position& pos) {
16081608

16091609
void RootMove::insert_pv_in_tt(Position& pos) {
16101610

1611-
StateInfo state[MAX_PLY_PLUS_3], *st = state;
1611+
StateInfo state[MAX_PLY_PLUS_6], *st = state;
16121612
const TTEntry* tte;
16131613
int ply = 0;
16141614

@@ -1683,7 +1683,7 @@ void Thread::idle_loop() {
16831683

16841684
Threads.mutex.unlock();
16851685

1686-
Stack stack[MAX_PLY_PLUS_3], *ss = stack+2; // To allow referencing (ss-2)
1686+
Stack stack[MAX_PLY_PLUS_6], *ss = stack+2; // To allow referencing (ss-2)
16871687
Position pos(*sp->pos, this);
16881688

16891689
std::memcpy(ss-2, sp->ss-2, 5 * sizeof(Stack));

src/types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ typedef uint64_t Bitboard;
9090

9191
const int MAX_MOVES = 192;
9292
const int MAX_PLY = 100;
93-
const int MAX_PLY_PLUS_3 = MAX_PLY + 3;
93+
const int MAX_PLY_PLUS_6 = MAX_PLY + 6;
9494

9595
/// A move needs 16 bits to be stored
9696
///

0 commit comments

Comments
 (0)