https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69224
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2016-01-11 CC| |hubicka at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- If you comment the line x is a trailing array we don't know its size for and thus we don't warn. As with (many?) other cases this happens because complete peeling added one copy too much (too conservative number of iteration upper bound): _72 = s_47->x[4]; if (_39 >= _72) goto <bb 20>; else goto <bb 23>; <bb 20>: _74 = s_47->x[5]; if (_39 <= _74) goto <bb 22>; else goto <bb 23>; so we have a x[5] in the IL and VRP can't prove it is not reachable either (obviously). niter analysis does: Statement _22 = s_7(D)->x[j_2]; is executed at most 4 (bounded by 4) + 1 times in loop 2. Statement _25 = s_7(D)->x[_24]; is executed at most 3 (bounded by 3) + 1 times in loop 2. Loop 2 iterates at most 5 times. t.c:16:33: note: loop with 6 iterations completely unrolled Latch of last iteration was marked by __builtin_unreachable (). Forced statement unreachable: _25 = s_7(D)->x[_24]; Forced statement unreachable: _22 = s_7(D)->x[j_2]; it looks like the conditionally read s->x[j] is not properly marked unreachable.