mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-22 12:47:08 +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
|
||||
Rui Coelho (ruicoelhopedro)
|
||||
rustam-cpp
|
||||
Ryan Lefkowitz (rlefko)
|
||||
Ryan Hirsch
|
||||
Ryan Schmitt
|
||||
Ryan Takker
|
||||
|
||||
@@ -949,8 +949,10 @@ encode_remaining:
|
||||
// groups (similar to what was done earlier for leading group pieces).
|
||||
for (int i = 0; i < d->groupLen[next]; ++i)
|
||||
{
|
||||
auto f = [&](Square s) { return groupSq[i] > s; };
|
||||
auto adjust = std::count_if(squares, groupSq, f);
|
||||
int adjust = 0;
|
||||
DISABLE_CLANG_LOOP_VEC
|
||||
for (Square* sq = squares; sq != groupSq; ++sq)
|
||||
adjust += groupSq[i] > *sq;
|
||||
n += Binomial[i + 1][groupSq[i] - adjust - 8 * remainingPawns];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user