[Bug c++/79950] G++ cannot detect simple off by one error in STL classes

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Mar 8 14:28:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79950

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The two cases are not equivalent, because the bounds of a[10] are known at
compile-time, but v.size() is not. The only way to know v.size() is with a
run-time check, which has a non-zero cost.


More information about the Gcc-bugs mailing list