我正在Ubuntu14.04上使用带有Clang3.7.0的MemorySanitizer。以下代码可以完美运行:#includeintmain(){doubleans;printf("HelloWorld:%f\n",ans);return0;}编译时clang++-g-O1-fsanitize=memory-fsanitize-memory-track-origins=2-fomit-frame-pointersanitize.cpp-osanitize我期待一个错误。MemorySanitizer没有捕捉到ans未初始化的事实吗?感谢您的帮助。 最佳答
我从centos7、clang-3.6.1中得到了完全相同的结果,这些结果是使用fedorarpm规范文件从源代码构建的。Ubuntu14.04,clang-3.4使用此处wiki中的说明https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo尽可能接近。该页面最后一次更新是在6个月前。googlest修订版613仍在使用tr1Infileincludedfrom/home/hal/googletest/src/gtest-all.cc:39:Infileincludedfrom/home/hal/goog
我希望在clang中使用-fsanitize=memory标志来分析如下程序:#include#include#includeusingnamespacestd;voidwriteToFile(){ofstreamo;o.open("dum");o据我所知,这个程序是正确的,但是当我使用clang++san.cpp-fsanitize=memory它失败(在运行时):UMRin__interceptor_writeatoffset0inside[0x64800000e000,+5)==9685==WARNING:MemorySanitizer:use-of-uninitialized-
我希望在clang中使用-fsanitize=memory标志来分析如下程序:#include#include#includeusingnamespacestd;voidwriteToFile(){ofstreamo;o.open("dum");o据我所知,这个程序是正确的,但是当我使用clang++san.cpp-fsanitize=memory它失败(在运行时):UMRin__interceptor_writeatoffset0inside[0x64800000e000,+5)==9685==WARNING:MemorySanitizer:use-of-uninitialized-