Using memory sanitizer with libstdc++
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I wish to use the -fsanitize=memory flag in clang to analyse a program like the following: #include #include #include using namespace std; void writeToFile(){ ofstream o; o.open("dum"); o As far as I know, this program is correct, but when I use clang++ san.cpp -fsanitize=memory It fails (at runtime) with: UMR in __interceptor_write at offset 0 inside [0x64800000e000, +5) ==9685== WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x7f48d0899ae5 (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0x7bae5) #1 0x7f48d08d1787 (/usr/lib/x86_64-linux