https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91878
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Konstantin Kharlamov from comment #0) > It either crashes on past-end access, or produces a warning (depending on > whether it's handled as a past-end access or UB). No, that's not how undefined behaviour works. You are wrong to expect a crash, and not all cases of undefined behaviour can be detected reliably. I don't think this case can be caught by sanitizers. As Marc said (and as I suggested on your previous bug report) you should use -D_GLIBCXX_DEBUG to catch these kind of bugs.