Skip to content

Latest commit

 

History

History
52 lines (43 loc) · 1.82 KB

asan.md

File metadata and controls

52 lines (43 loc) · 1.82 KB

How To Use Sanitizers

Sanitizers are tools which generate additional code in your program that can catch many common programming mistakes, such as:

General Advice

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.

GCC 4.8+

?inline

clang 3.1+

?inline

MSVC 19.27+ and VS 2019 16.9+

?inline

Sample Program

?inline

int main(void) {
    int x;
    return x;
}

-fsanitize=memory -g Output

?inline

SUMMARY: MemorySanitizer: use-of-uninitialized-value /tmp/test.cpp:3:5 in main Exiting
(3:5 is line and column of return)

Footer

?footer Note: The sanitizer lists for GCC and clang are not exhaustive