https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110807
--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> --- I don't think _M_offset can ever be out of range, it's always set by the library code. Doesn't the warning come from this line, which doesn't use _M_offset anyway? _Bit_type* __q = std::copy(__first._M_p, __last._M_p, __result._M_p); So I'm not sure what we can do in the library to state the invariants in a way the optimizer can understand them.