为什么内存清理程序报告为std :: map使用未初始化的值?

问题描述

我正在x86-64上使用manjaro linux。铛版本10.0.1中的内存清理程序报告了std::map中使用未初始化的值错误,这让我感到非常惊讶。我做错什么了吗?

$ cat test.cpp 
#include <map>
int main() {
    std::map<int,int> test;
    test.insert({1,2});
}
$ clang++ -fsanitize=memory test.cpp && ./a.out
==51936==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x562889eaad9a  (/tmp/build/a.out+0x9fd9a)
    #1 0x562889eaae28  (/tmp/build/a.out+0x9fe28)
    #2 0x562889eaaba1  (/tmp/build/a.out+0x9fba1)
    #3 0x562889eaa51e  (/tmp/build/a.out+0x9f51e)
    #4 0x562889eaa087  (/tmp/build/a.out+0x9f087)
    #5 0x7f418e02b151  (/usr/lib/libc.so.6+0x28151)
    #6 0x562889e2b1dd  (/tmp/build/a.out+0x201dd)

SUMMARY: MemorySanitizer: use-of-uninitialized-value (/tmp/build/a.out+0x9fd9a) 
Exiting

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...