On 10/12/2017 10:16 AM, Mason wrote: > Hello, > > Consider the following testcase: > > extern int n, xyz, array[8]; > void foo(void) > { > int i, j, Dupe; > > for (i = 0; i < n; i ++) { > Dupe = 0; > for (j = 0; j < i; j ++) > if (array[j] == array[i]) > Dupe = 1; > if (array[i] && !Dupe) > xyz = 42; > } > } > > $ gcc-7.2 -Wall -O3 -S testcase.c > testcase.c: In function 'foo': > testcase.c:11:12: warning: array subscript is above array bounds [-Warray-bounds] > if (array[i] && !Dupe) > ~~~~~^~~ > > $ gcc-6.3 -Wall -O3 -S testcase.c > /* NO WARNING */ > > I'm not sure how/why GCC concludes out-of-bounds access? > Could it be a false positive? -O3 turns on loop unrolling which often triggers false positives for the out-of-bounds array index checks. I believe there's a number of bugs in the BZ database WRT this issue. You might consider attaching your testcase to one of them. jeff