http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59932
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Zhendong Su from comment #6) > Thanks for your explanation Jakub. It's more clear now, but I still don't > fully understand the difference in behavior from 4.8 to the current trunk. > > Is it because 4.8's support for warning undefined behaviors is weaker than > 4.9's, and with that enhanced support, 4.9 sometimes gives false warnings > like the one reported here? 4.8 only warned about this in later passes when the loops have been already constructed and preserved, so it wouldn't warn e.g. if it was cunrolli (as in this case) that found the undefined behavior. GCC 4.9 creates loops immediately after cfg is created and the warning is thus enabled much earlier. This means we warn in more cases when it is desirable to warn, but as this testcase shows also sometimes means there can be false positives. The loop with the undefined behavior is there for many passes, from cunrolli where it warns another 20 passes until dom1 is able to find out the code is dead.