https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120735
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
unsigned int dataSize = 4;
//assert(dataSize + n > dataSize);
dataSize += n;
Yes you need to check for an wrapping condition inside f to be 100% correct.
GCC is correctly warning here.
For `resize(0)`, std::vector has a nullptr as the vector is empty, *data() does
not have to be deferencable so a nullptr for data() is valid.
that is what is happening here.