When I try to build my c++ project with memory sanitizer using the CMake sanitizers modules here, I get this warning:
MemorySanitizer is not available for GNU compiler.
Although when I searched on google it is stated here that GNU compiler supports memory sanitizer.
My development enviroment is WSL2 Ubuntu 20.04 and compiler version is 9.4.0.
As stated in the comments, the GCC documentation does not document support for MemorySanitizer. There is no entry for
-fsanitize=memory
- but it has-fsanitize=address
,-fsanitize=leak
,-fsanitize=thread
and several others.The High Performance Computing wiki page you linked in you question says:
So it looks like it is speaking in broad strokes and that those broad strokes are wrong specifically for GCC and MemorySantizer.
Cross reference: Google wiki page on MSan:
Page for Clang support: https://clang.llvm.org/docs/MemorySanitizer.html.
For your reference, the line of CMake code in the CMake helper modules you are using that prints that diagnostic message is here: https://github.com/arsenm/sanitizers-cmake/blob/77df84a2af66d35bec00205651cee7de6b2b2609/cmake/sanitize-helpers.cmake#L152.