lucasart / Demolito

UCI Chess Engine
GNU General Public License v3.0
45 stars 9 forks source link

debug compile crashes #135

Closed lucasart closed 5 years ago

lucasart commented 5 years ago

Reproduction still quite complex:

lucasart commented 5 years ago

This is not really a bug, in fact:

assert(idx < 4096);
return -SafetyCurve[idx & 4095];  /* idx shouldn't exceed 4095, but just in case, prevent overflow,
        while not taxing performance (min(idx, 4096) is slow because it adds a branch).*/

The logic is:

lucasart commented 5 years ago

Smaller repro:

position fen 1B4Q1/8/2N5/5k2/4n3/3Q3p/7P/6RK b - - 0
eval
. B . . . . Q .
. . . . . . . .
. . N . . . . .
. . . . . k . .
. . . . n . . .
. . . Q . . . p
. . . . . . . P
. . . . . . R K
1B4Q1/8/2N5/5k2/4n3/3Q3p/7P/6RK b - - 0
demolito: ./src/eval.c:229: int safety(const Position *, int, bitboard_t (*)[7]): Assertion `idx < 4096' failed.
Aborted (core dumped)