http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59371
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2013-12-05 Ever confirmed|0 |1 --- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- Btw, the change suggests a workaround - use -fwrapv. And indeed, the loop does not terminate for c == 32768, but that's a "bug" in the testcase, signed short < 32768 is always true (both promote to int, and i++ wraps at 32767). That i++ now correctly wraps 'defined' also means that IV analysis is pessimized as it can not assume that 'i' does not wrap nor can it assume that the loop terminates. But that's just the awkward way the testcase is written (without the C standard in mind ...). You may also try -funsafe-loop-optimizations that makes us optimistically assume IVs don't overflow and loops terminate. "confirmed", but I think this one needs more analysis on _what_ transform we want to happen and then get assessment on if that is a valid transform at all.