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

            Bug ID: 115771
           Summary: false postiv -Wstringop-overread with -O2
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Shun.Yao at de dot bosch.com
  Target Milestone: ---

Created attachment 58583
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58583&action=edit
example to reproduce the error. compile with -O2

Starting from gccV9, if compiled with -O2 switch, the gcc produce false positiv
 stringop-overread warning.

An example to reproduce the error is attached.

it seems the gcc try to optimize the performance by inline memcpy, but it
generate code for memcpy with length of LENGTH. but this scenario will never
happen. it causes only stringop-overread warning

Reply via email to