https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108288
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- The patch doesn't change libstdc++.so, it only changes the headers. You don't even need to rebuild GCC. You could just put a patched copy of safe_iterator.h in /tmp/x/debug and then compile with -I/tmp/x so it finds the patched header.