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

--- Comment #37 from Domani Hannes <ssbssa at yahoo dot de> ---
With the new patch there is still a warning with this example:
=============== 8< ===============
int f(void);

int test(void)
{
  int baz[4];
  int q = 0;
  int d, i, j, sum;

  for (i = 0; i < 2; i++)
  {
    d = f();

    if (d == 3)
    {
      baz[q] = d;
      q++;
      if (q == 4) break;
    }
  }

  sum = 0;
  for (i = 0; i < q; i++)
  {
    for (j = i + 1; j < q; j++)
    {
      sum += baz[j];
    }
  }

  return (sum);
}
=============== >8 ===============
$ gcc -O3 -Wall -S q.c
q.c: In function 'test':
q.c:27:17: warning: array subscript is above array bounds [-Warray-bounds]
       sum += baz[j];
                 ^

Reply via email to