This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/59124] [5/6/7 Regression] Wrong warnings "array subscript is above array bounds"


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

Szőts Ákos <szotsaki at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |szotsaki at gmail dot com

--- Comment #41 from Szőts Ákos <szotsaki at gmail dot com> ---
A newer example:

int main() {
  bool exists = true;
  int i = 0;
  int sum = 0;

  volatile int array_size = 7;
  volatile int array[7];

  while (exists)
  {
    for (i = 0; i < array_size - 1; i++)
    {
      if (array[i] == 0) sum += array[i + 1];
      exists = false;
    }
  }

  return 0;
}

Can be reproduced both by v5.3.0 and v6.1.1 with "g++ -O3 -Wall main.cpp".

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]