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

            Bug ID: 111213
           Summary: -Wanalyzer-out-of-bounds false negative with `return
                    arr[9];`
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: dale.mengli.ming at proton dot me
  Target Milestone: ---

Hi, this case (https://godbolt.org/z/98PMz1KKz) contains an out-of-bound error
(stmt: `return arr[9];`). At -O0, the analyzer can report this warning.
However, at -O1, -O2, and -O3, the analyzer doesn't report that.

After removing the `static` keyword (https://godbolt.org/z/qKohK3eeY), the
analyzer can report this warning at -O1, -O2, and -O3.

Reply via email to