Sanitizers are tools which generate additional code in your program that can catch many common programming mistakes, such as:
Not all sanitizers can be combined, but when they can, use e.g.:
-fsanitize=address,undefined
to combine them.
Always compile with debug info to get line numbers, variable names, etc.
?inline
- -fsanitize=address
- -fsanitize=undefined
- -fsanitize=thread
- -g for debug info
?inline
- -fsanitize=address
- -fsanitize=undefined
- -fsanitize=thread
- -fsanitize=memory
- -g for debug info
?inline
- -fsanitize=address
- -Zi for debug info
?inline
int main(void) {
int x;
return x;
}
?inline
SUMMARY: MemorySanitizer: use-of-uninitialized-value /tmp/test.cpp:3:5 in main Exiting
(3:5
is line and column ofreturn
)
?footer Note: The sanitizer lists for GCC and clang are not exhaustive