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

            Bug ID: 80641
           Summary: Warning with std::vector resize in loop
           Product: gcc
           Version: 7.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: HZ2012 at gmx dot at
  Target Milestone: ---

#include <vector>
int main()
{
    std::vector<int> c {1,2,3,0};
    while(c.size() > 0 && c.back() == 0)
    {
        auto sz = c.size() -1;
        c.resize(sz);
    }
    return 0;
}

$ c++7.1 -O3 tt.cxx
cc1plus: warning: 'void* __builtin_memset(void*, int, long unsigned int)':
specified size 18446744073709551612 exceeds maximum object size
9223372036854775807  -Wstringop-overflow=]

No warning comes when I use GCC 6.1

Reply via email to