https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49283
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2014-10-03 Ever confirmed|0 |1 --- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- (In reply to bruno from comment #3) > (In reply to comment #2) > > [GCC] optimizes [...] > > moving the + 3 from the LHS and combining it with the constant offset > > on the RHS. That is only valid if p + 3 does not get outside of buff > > which GCC doesn't see > > Rather than performing an invalid optimization (that is, produce wrong-code) > with a warning, I would prefer if GCC would simply only do valid > optimizations. In general, it is not possible to say that a program is valid or not while compiling it. (It might be possible in this case, nonetheless, I haven't looked at the details) This case in particular seems too noisy (and the warning message itself does not help to figure out what is wrong). Perhaps we should not enabled by default this one in particular