Can sanitizers find the two bugs I wrote in C++?
asan&#x2F;ubsan are great for finding language-level undefined behavior.
But apart from some functions like memcpy that asan is hooking, they cannot find library-level undefined behavior such as the pop_back() on the empty vector. (That&#x27;s an inline function inside a template, there&#x27;s no way asan could hook this!)<p>I recommend using `-D_GLIBCXX_ASSERTIONS` in addition to `-fsanitize=undefined,address`. This will enable some cheap assertions in libstdc++ that catch stuff like the invalid pop_back() call. In fact it might not be a bad idea to keep these assertions enabled in release builds!
(There is also `-D_GLIBCXX_DEBUG` which enables even more assertions, but some of those are expensive)