check for material key validity in tbprobe

During recent work on threat inputs, there was a hard-to-debug crash in tbprobe
caused by incorrectly computing st->materialKey. This PR adds correctness
checking to pos_is_ok and a faster check in tbprobe that will actually run in
CI (because pos_is_ok checking is disabled even in debug mode, for performance
purposes).

closes https://github.com/official-stockfish/Stockfish/pull/6410

No functional change
This commit is contained in:
Timothy Herchen
2025-11-13 22:42:10 +01:00
committed by Joost VandeVondele
parent 3f2405bf4e
commit 229bd1e2e3
3 changed files with 17 additions and 3 deletions
+2
View File
@@ -169,6 +169,7 @@ class Position {
// Position consistency check, for debugging
bool pos_is_ok() const;
bool material_key_is_ok() const;
void flip();
StateInfo* state() const;
@@ -180,6 +181,7 @@ class Position {
private:
// Initialization helpers (used while setting up a position)
void set_castling_right(Color c, Square rfrom);
Key compute_material_key() const;
void set_state() const;
void set_check_info() const;