Note: I don't think we're there yet, but it's something to start thinking about a bit. _GLIBCXX_ASSERTIONS enables bounds-checking in various libstdc++ containers. Since bug 876895, we've enabled it by default for hardened builds. GCC 15 will enable it by default for -O0. The main question is how big is the performance hit, and is it acceptable? I think we want to wait until more work is done in GCC to optimise the conditions better. There's a few things GCC still needs to handle better with new/delete to allow it to optimise very common C++ idioms even without assertions, but the work going into that (much of which will land in 15) will affect assertion cases too. References: * https://chandlerc.blog/posts/2024/11/story-time-bounds-checking/ * https://security.googleblog.com/2024/11/retrofitting-spatial-safety-to-hundreds.html * https://bughunters.google.com/blog/6368559657254912/llvm-s-rfc-c-buffer-hardening-at-google