http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53128
--- Comment #3 from rguenther at suse dot de <rguenther at suse dot de> 2012-04-27 08:02:39 UTC --- On Thu, 26 Apr 2012, amonakov at gcc dot gnu.org wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53128 > > Alexander Monakov <amonakov at gcc dot gnu.org> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Status|WAITING |RESOLVED > CC| |amonakov at gcc dot > | |gnu.org, rguenth at gcc dot > | |gnu.org > Resolution| |INVALID > > --- Comment #2 from Alexander Monakov <amonakov at gcc dot gnu.org> > 2012-04-26 16:20:39 UTC --- > The code invokes undefined behavior as the increment statement of the outer > loop tries to access ss[tt].a1[14] at the last iteration. GCC optimizes out > the loop exit test due to recent changes by Richard Guenther. > > Richard, I think a warning here would be very helpful (I remember you > mentioned > that in IRC too). What would implementing such a warning involve? It's very difficult to warn for this as at the point we use the information to optimize the loop exit test we do not know where it came from. Thus, apart from warning on every exit test we optimize that way (with the obvious false positives and the fact the warning would be very unspecific "warning: optimized loop exit test") I see no way of warning here. Other loop optimizations also can take advantage of this fact without knowing. Richard.