I have a simple and errorless C++ code.
If I turn "All (/Qcheck-pointers-dangling:all)", program failed with message and system exception:
CHKP: Bounds check error ptr=0X00000022EB6191C0 sz=4 lb=0X0000000000000002 ub=0000000000000000 loc=0X00007FF64E191A88
"Unhandled exception at 0x00007FF98CF7DA4A (ntdll.dll) in ConsoleApplication5.exe: A LIST_ENTRY has been corrupted (i.e. double remove)."
Building with Intel(R) C++ Compiler 16.0, ClCompile (x64 - Intel C++)
struct ctest { std::vector<int> plan_; ctest(void* h, uint8_t pid, size_t blk_size, size_t blk_num) { foo(); } ctest() { foo(); } void foo() { plan_.push_back(1); auto& v = plan_.back(); v = 0; } }; void foo_1(void) { ctest buf_(0,0,0,0); } void foo_2(void) { ctest buf_(); } int main() { // passed for (int i = 0; i < 64; ++i) { std::thread d(foo_2); d.join(); } // failed at 64th iteration for (int i = 0; i < 64; ++i) { std::thread d(foo_1); d.join(); } return 0; }