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/64277] [4.9/5 Regression] Incorrect warning "array subscript is above array bounds"


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

Ilya Enkovich <enkovich.gnu at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |enkovich.gnu at gmail dot com

--- Comment #7 from Ilya Enkovich <enkovich.gnu at gmail dot com> ---
Here is a reduced test case:

>cat test.c
int f1[10];
void foo(short a[], short m, unsigned short l)
{
  int i = l;
  for (i = i + 5; i < m; i++)
    f1[i] = a[i]++;
}
>gcc test.c -O3 -c -Wall
test.c: In function 'foo':
test.c:6:7: warning: array subscript is above array bounds [-Warray-bounds]
     f1[i] = a[i]++;
       ^
test.c:6:7: warning: array subscript is above array bounds [-Warray-bounds]
test.c:6:7: warning: array subscript is above array bounds [-Warray-bounds]
test.c:6:7: warning: array subscript is above array bounds [-Warray-bounds]
test.c:6:7: warning: array subscript is above array bounds [-Warray-bounds]

Here we have complete unroll of the loop by 10 due to f1 size.  Later vrp
complains of last five produced iterations accessing above array bounds.

Used GCC 5.0.


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