https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109442
--- Comment #31 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Jan Hubicka from comment #30) > I will test the _M_invariant patch same way. While it should not have > effect on inliner (I will double-check), I am not sure it is a good idea. > It adds a lot of loads to often uses size accessor which will take some > effort for middle-end to handle. Yeah, good point. So better to go with your separate checks in size() and capacity() which only load the values that those functions need anyway. That patch is OK for trunk if you're happy with its codegen.