mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-22 20:57:10 +00:00
fix syzygy crash on Apple Silicon by unrolling tbprobe adjustment loop
A bit tricky to identify, but in `apple-silicon` builds, specifying a value for `SyzygyPath` could still lead to crashes at certain depths from a SIGBUS/SIGSEGV. This PR replaces the `std::count_if()` adjustment in `tbprobe.cpp`'s `do_probe_table()` with an annotated handwritten loop, avoiding the clang/LTO miscompilation behind the crash. closes https://github.com/official-stockfish/Stockfish/pull/6721 No functional change.
This commit is contained in:
committed by
Joost VandeVondele
parent
b63bd7b78e
commit
bb5f0100b0
@@ -223,6 +223,7 @@ Ron Britvich (Britvich)
|
|||||||
rqs
|
rqs
|
||||||
Rui Coelho (ruicoelhopedro)
|
Rui Coelho (ruicoelhopedro)
|
||||||
rustam-cpp
|
rustam-cpp
|
||||||
|
Ryan Lefkowitz (rlefko)
|
||||||
Ryan Hirsch
|
Ryan Hirsch
|
||||||
Ryan Schmitt
|
Ryan Schmitt
|
||||||
Ryan Takker
|
Ryan Takker
|
||||||
|
|||||||
@@ -949,8 +949,10 @@ encode_remaining:
|
|||||||
// groups (similar to what was done earlier for leading group pieces).
|
// groups (similar to what was done earlier for leading group pieces).
|
||||||
for (int i = 0; i < d->groupLen[next]; ++i)
|
for (int i = 0; i < d->groupLen[next]; ++i)
|
||||||
{
|
{
|
||||||
auto f = [&](Square s) { return groupSq[i] > s; };
|
int adjust = 0;
|
||||||
auto adjust = std::count_if(squares, groupSq, f);
|
DISABLE_CLANG_LOOP_VEC
|
||||||
|
for (Square* sq = squares; sq != groupSq; ++sq)
|
||||||
|
adjust += groupSq[i] > *sq;
|
||||||
n += Binomial[i + 1][groupSq[i] - adjust - 8 * remainingPawns];
|
n += Binomial[i + 1][groupSq[i] - adjust - 8 * remainingPawns];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user