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

--- Comment #2 from Dmitry Gorbachev <d.g.gorbachev at gmail dot com> ---
Another testcase:

============= 8< =============
extern char *bar[17];

int foo(int argc, char **argv)
{
  int i;
  int n = 0;

  for (i = 0; i < argc; i++)
    n++;

  for (i = 0; i < argc; i++)
    argv[i] = bar[i + n];

  return 0;
}
============= >8 =============

$ gcc -S -Wall -O3 2.c
2.c: In function 'foo':
2.c:12:18: warning: array subscript is above array bounds [-Warray-bounds]
     argv[i] = bar[i + n];
                  ^
2.c:12:18: warning: array subscript is above array bounds [-Warray-bounds]
2.c:12:18: warning: array subscript is above array bounds [-Warray-bounds]
2.c:12:18: warning: array subscript is above array bounds [-Warray-bounds]
2.c:12:18: warning: array subscript is above array bounds [-Warray-bounds]
2.c:12:18: warning: array subscript is above array bounds [-Warray-bounds]
2.c:12:18: warning: array subscript is above array bounds [-Warray-bounds]
2.c:12:18: warning: array subscript is above array bounds [-Warray-bounds]
2.c:12:18: warning: array subscript is above array bounds [-Warray-bounds]

Reply via email to