https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100516
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- Once again the problem is that GCC warns about code which is unreachable by construction. The loop bounds are determined by the deque's "map", which is sized correctly for the incoming range. I don't see this with trunk, but for GCC 11 adding this to the loop body works: if (__n < _S_buffer_size()) __builtin_unreachable();