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

            Bug ID: 107798
           Summary: optimizing -O3, "for" loop condition not checked
                    anymore
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: angelo70 at gmail dot com
  Target Milestone: ---

Created attachment 53938
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53938&action=edit
sample code of the bug

Hi,

in the attached code, i < 3 * 3 is not checked anymore when optimizing by -O3.

This is visible disassembling. With -O3 the disassembled code only checks for a
zero-termination of the array, not finding it, it is proceeding over 8.

Checking for zero-termination seems a wrong assumption, for loop should never
pass over 8 in any case.

Reply via email to