http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57199
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2013-05-08
08:57:45 UTC ---
Note that there seems to be an error in the source:
void resize(size_t n) {
size_t s = size();
DestroyElements(mutable_array() + n, s - n);
for the call with n == size () + 1 the function calls DestroyElements
with -1U elements which we figure out and optimize the caller to
<bb 3>:
_13 = i_12 * 80;
_14 = _11 + _13;
Foo::~Foo (_14);
i_15 = i_12 + 1;
<bb 4>:
# i_12 = PHI <0(2), i_15(3)>
if (i_12 != 18446744073709551615)
goto <bb 3>;
else
goto <bb 5>;
which then causes the addition to overflow and invoke undefined behavior
and we warn.
Thus, the warning, while not 100% helpful, points at a real problem.