下面的代码没有做任何有趣的事情,但神秘的是为什么 Dr Memory 会认为有一个单元化读取?有任何想法吗?
#include <memory>
int main(int argc, const char* argv[])
{
int aa[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
std::unique_ptr<int[]> p {new int[10]};
for (auto i = 0; i < 10; ++i) {
p[i] = aa[i];
}
return 0;
} // <-- Dr Memory says UNINITIALIZED READ here
编辑:这是完整的错误详细信息。
Error #1: UNINITIALIZED READ: reading 0x0028ff20-0x0028ff24 4 byte(s)
# 0 __mingw_glob [src/main.cpp:14]
# 1 _setargv [src/main.cpp:14]
# 2 __mingw_CRTStartup
# 3 mainCRTStartup
# 4 ntdll.dll!RtlInitializeExceptionChain +0x62 (0x772c8fe2 <ntdll.dll+0x38fe2>)
# 5 ntdll.dll!RtlInitializeExceptionChain +0x35 (0x772c8fb5 <ntdll.dll+0x38fb5>)
Note: @0:00:00.297 in thread 9780
Note: instruction: cmp (%esi) $0x0040a11e