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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
And for this example it's possible that g(int) modifies the vector that the
reference v is bound to, so the size could even change on every loop iteration.
So if we added some runtime checks to std::vector (maybe only enabled for
_FORTIFY_SOURCE) then the size() would need to be reloaded on every loop
iteration, it couldn't be hoisted out of the loop. So that also suggests it
would have to be a special case handled by the front end, just for
std::vector::size()

Reply via email to