https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106901
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Summary|False positive |[13 Regression] False |-Warray-bounds with -O2 or |positive -Warray-bounds |higher? |with -O2 or higher? Component|c++ |tree-optimization Known to work| |12.2.0 Blocks| |56456 Resolution|--- |INVALID Target Milestone|--- |13.0 --- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- I think this is invalid. We inline bar into foo and see if (size < 5) return false; for (i = 5; i < size; ++i) if (vec[i] != 0) .... so we know that vec[5] is accessed when the loop is executed which is out of bounds and we diagnose that. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456 [Bug 56456] [meta-bug] bogus/missing -Warray-bounds