<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Hello, I am Bin, thanks for your contribution to deliver to developers one of the most innovative compilers.<div><br></div><div>I have encountered a alloc/dealloc mismatch while running a simple demo about exception handling, using clang 18 and libc++</div><div>which are installed following the instruction on <a href="https://apt.llvm.org/">https://apt.llvm.org/</a>. I spent some time inspecting the assembly code of the</div><div>demo program, libc++ and libc++abi, it turns out:</div><div><br></div><div>1. While initializing an instance of std::runtime_error, an internal string was allocated on the heap with the new operator which is provided by</div><div> AddressSanitizer and located in the main module. So the memory was tracked.</div><div><br></div><span>2. During the last step of handling the exception, the exception was released by std::runtime_error::~runtime_error in libc++abi.so.1. However,</span><div><span> the </span>memory for the string was released by calling the statically linked delete operator (not the one implemented by ASan, and it called Asan’s</div><div> free function. Consequently, a mismatch between allocation and deallocation was detected.</div><div><br></div><div>3. I have post more details on <a href="https://github.com/llvm/llvm-project/issues/59432#issuecomment-1988788696">https://github.com/llvm/llvm-project/issues/59432#issuecomment-1988788696</a></div><div><br></div><div>I am a compiler love, and I would like to offer some, so feel free to contact me.</div><div><br></div><div>Regards, Bin</div><div><div><div><div><br></div><div><br></div></div><div></div></div></div></body></html>