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

            Bug ID: 82698
           Summary: Spurious warning __builtin_memset at O3
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: paulg at chiark dot greenend.org.uk
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

With the following code fragment

#include <vector>

void foo(std::vector<int> & bar)
{
    bar.resize(bar.size() - 1);
}

compiled with

g++ -c -O3 -Wall -Wextra test.cpp

the following is produced

cc1plus: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’:
specified size 18446744073709551612 exceeds maximum object size
9223372036854775807 -Wstringop-overflow=]

Since the compiler cannot know if the user has arranged to never pass a
argument which would produce this problem this seems like overreach on the part
of the compiler.

Reply via email to