https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79950
Martin Sebor changed:
What|Removed |Added
CC||msebor at gcc dot gnu.org
--- Comment #7
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79950
--- Comment #6 from Jonathan Wakely ---
(In reply to Jonathan Wakely from comment #5)
> (In reply to David Binderman from comment #4)
> > Anyway, I think some progress could be made by finding the pattern
> >
> > for (something = 0;
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79950
--- Comment #5 from Jonathan Wakely ---
(In reply to David Binderman from comment #4)
> (In reply to Jonathan Wakely from comment #3)
> > And for this example it's possible that g(int) modifies the vector that the
> > reference v is bound to
>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79950
--- Comment #4 from David Binderman ---
(In reply to Jonathan Wakely from comment #3)
> And for this example it's possible that g(int) modifies the vector that the
> reference v is bound to
I doubt g can modify v.
Anyway, I think some progress
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79950
--- Comment #3 from Jonathan Wakely ---
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
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79950
--- Comment #2 from Jonathan Wakely ---
The C++ front-end could be taught about std::vector::size() as a special case,
but that would only help that special case, it wouldn't help for
std::deque::size(), or boost::vector::size() or other types.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79950
--- Comment #1 from Jonathan Wakely ---
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.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79950
Richard Biener changed:
What|Removed |Added
Keywords||diagnostic
Severity|normal