Hi,
I suggest compiling it with the -ggdb3 flag and running it from valgrind.
This shows up quite a few uninitialized-but-used variables:
Code: Select all
==2128== Conditional jump or move depends on uninitialised value(s)
==2128== at 0x11532C: Engine::print_best_line(int) [clone .constprop.9] (hash.cpp:290)
==2128== by 0x10F324: Engine::search_root() (engine.cpp:1132)
==2128== by 0x11A312: UCI::go(std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >&) (engine.cpp:965)
==2128== by 0x11267E: UCI::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (uci.cpp:217)
==2128== by 0x10C059: main (main.cpp:23)
==2128== Conditional jump or move depends on uninitialised value(s)
==2128== at 0x114304: Engine::negamax(int, int, int, int) [clone .part.121] (hash.cpp:349)
==2128== by 0x10F4F9: Engine::search_root() (engine.cpp:805)
==2128== by 0x11A312: UCI::go(std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >&) (engine.cpp:965)
==2128== by 0x11267E: UCI::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (uci.cpp:217)
==2128== by 0x10C059: main (main.cpp:23)
==2128== Conditional jump or move depends on uninitialised value(s)
==2128== at 0x114318: Engine::negamax(int, int, int, int) [clone .part.121] (hash.cpp:356)
==2128== by 0x10F4F9: Engine::search_root() (engine.cpp:805)
==2128== by 0x11A312: UCI::go(std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >&) (engine.cpp:965)
==2128== by 0x11267E: UCI::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (uci.cpp:217)
==2128== by 0x10C059: main (main.cpp:23)
==2128== Conditional jump or move depends on uninitialised value(s)
==2128== at 0x11B495: Engine::print_best_line(int) (hash.cpp:290)
==2128== by 0x115400: Engine::print_best_line(int) [clone .constprop.9] (engine.cpp:1027)
==2128== by 0x10F324: Engine::search_root() (engine.cpp:1132)
==2128== by 0x11A312: UCI::go(std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >&) (engine.cpp:965)
==2128== by 0x11267E: UCI::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (uci.cpp:217)
==2128== by 0x10C059: main (main.cpp:23)
To reduce the noise about the hash table a bit, I suggest the following patch:
Code: Select all
diff -r 3123b374dcc8 hash.cpp
--- a/hash.cpp Thu Jun 01 03:34:40 2017 -0400
+++ b/hash.cpp Thu Jun 01 12:37:28 2017 +0200
@@ -261,6 +261,7 @@
TranspositionsTable::TranspositionsTable(size_t size_in_bytes) {
size = size_in_bytes / sizeof(HashEntry);
hash_table = new HashEntry[size];
+ memset(hash_table, 0x00, size);
}