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

--- Comment #2 from Ilya Leoshkevich <iii at linux dot ibm.com> ---
C-Reduced version:

struct a {
  long b[128 / (8 * 8)];
};
int c;
void d() {
  a *e;
  long f;
  int g = 1;
  for (; g >= 0; g--) {
    f = e->b[g];
    if (f)
      goto h;
  }
  __builtin_unreachable();
h:
  c = g;
}

Repro:

$ PATH=build/prev-gcc:$PATH xg++ -c -O2 -Warray-bounds bitmap.E.c
bitmap.E.c: In function ‘void d()’:
bitmap.E.c:10:15: warning: array subscript -1 is below array bounds of ‘long
int [2]’ [-Warray-bounds]
     f = e->b[g];
         ~~~~~~^

Reply via email to