Tools such as Valgrind and Clang memory sanitizer (clang++ -fsanitize=memory
) can check for reads of uninitalised memory (valgrind warns you by default). Valgrind is a runtime detector and clang is a static analyser, so you'll probably want the latter. The GCC toolchain does not offer an equivalent tool as far as I know.