fsanitizememorytrackorigins
MemorySanitizer, accessible via the compiler flag -fsanitize=memory, is a runtime error detector in the LLVM Sanitizers suite designed to find uses of uninitialized memory in C and C++ programs. It instruments code so that every memory access consults a shadow memory that tracks whether each byte is defined or undefined. Before a memory read occurs, the sanitizer checks the corresponding shadow bytes; if any part of the read uses undefined data, it reports an error with a stack trace and the location of the offending read.
How it works: during compilation, each memory location is assigned a corresponding shadow location. The compiler
Usage: compile the program with -fsanitize=memory and link with the sanitizers runtime. Running the instrumented program
History: MemorySanitizer was introduced as part of LLVM's sanitizers to address a long-standing class of defects: