[Bug tree-optimization/80641] missed optimization with with std::vector resize in loop
ramana at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 16 08:47:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80641
--- Comment #12 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #11)
> *** Bug 86516 has been marked as a duplicate of this bug. ***
(In reply to Paul Gotch from comment #10)
> I'm afraid the changes made to libstdc++ have only solved part of the
> regression if you say something like
>
> std::vector<int> v;
>
> if(c.size() > 0)
> c.resize(c.size() - 1);
>
> then you no longer get a warning in 7.3 however if instead you do
>
> if(! c.empty())
> c.resize(c.size() -1);
>
> the warning is produced just as in early 7.x releases. No warning is
> produced in 6.x so this is still a regression.
>
> I presume this happens as empty wasn't annotated in libstdc++ and the
> underlying data flow analysis bug is yet to be fixed.
So why is this not a regression ? It's quite clear that the annotations did not
do enough to workaround the issue.
More information about the Gcc-bugs
mailing list