http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55079
Jan Hubicka <hubicka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[4.8 regression] false |[4.8 regression] false |positive -Warray-bounds |positive -Warray-bounds | |(also seen at -O3 | |bootstrap) --- Comment #8 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-11-14 19:31:16 UTC --- Hi, at -O3 bootstrap we have false positive on simplify-rtx.c ../../gcc/simplify-rtx.c: In function ‘rtx_def* simplify_plus_minus(rtx_code, machine_mode, rtx, rtx)’: ../../gcc/simplify-rtx.c:4285:63: warning: array subscript is below array bounds [-Warray-bounds] while (j-- && simplify_plus_minus_op_data_cmp (ops[j].op, save.op)); the siplified testcase is as follows: int a[8]; void test(unsigned int n) { unsigned int i; unsigned int j; if (n<8) for (j=0;j<n;j++) { i = j; do a[i+1]=a[i]; while (i--); } } here we unroll the inner do loop 7 times based on the array bounds derived from [i] access. Afterwards VRP proves that j is always at most 7 and thus the loop walks out of bounds. Here we may be able to determine that the loop accesses both i and i+1 and we could actually unroll only 6 times, but we handle each of array access independently.