clangclang++sanitizermemory-sanitizer

How to make MemorySanitizer not stop after one error


Clang's documentation says that "By default, MemorySanitizer exits on the first detected error."

Does somebody know how to make MemorySanitizer not to stop on errors? The above sentence suggests that there is a way, but I do not find anything in the documentation.


Solution

  • It seems the -fsanitize-recover=memory option should fit.

    From clang documentation:

    Controls which checks enabled by -fsanitize= flag are non-fatal. If the check is fatal, program will halt after the first error of this kind is detected and error report is printed.

    Using-fsanitize-recover=all should make all errors non fatal.

    There's also some Google documentation about this (search for continue-after-error):

    https://github.com/google/sanitizers/wiki/AddressSanitizer