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

            Bug ID: 107129
           Summary: [13 Regression] False positive -Wstringop-overflow
                    warning with -O2 or -O3
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: daniel at constexpr dot org
  Target Milestone: ---

Created attachment 53652
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53652&action=edit
Reduced testcase

The attached testcase produces the following warning with GCC 13.0.0 20221002
(commit 3290dcf):

$ /opt/gcc-dev/bin/c++ -O2 -c test.cpp 
test.cpp: In member function ‘void C::f()’:
test.cpp:39:33: warning: writing 1 byte into a region of size 0
[-Wstringop-overflow=]
   39 |                         c[i] = e(1.f - i, i);
      |                                ~^~~~~~~~~~~~
test.cpp:9:23: note: at offset 1 into destination object ‘C4::r’ of size 1
    9 |         unsigned char r;
      |

Reply via email to