https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91878
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Konstantin Kharlamov from comment #6) > (In reply to Jonathan Wakely from comment #5) > > > No, that's not how undefined behaviour works. You are wrong to expect a > > crash > > No, in context of the report I'm not. You're correct this is not how UB > works, but this is how address sanitizer does. The past-the-end iterator of a std::set doesn't point to the heap, and points to a valid object that is always readable. I don't see how asan can help here. > > and not all cases of undefined behaviour can be detected reliably. > > Well, given -D_GLIBCXX_DEBUG does handle it, probably sanitizer can either. No, I don't agree. They work very differently. Closing the bug was not an accident, I don't believe there are any plans to add asan instrumentation to std::set, and I don't believe it's possible to handle the past-the-end case.