This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/59932] spurious undefined behavior warning on valid code
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 28 Jan 2014 21:45:18 +0000
- Subject: [Bug tree-optimization/59932] spurious undefined behavior warning on valid code
- Auto-submitted: auto-generated
- References: <bug-59932-4 at http dot gcc dot gnu dot org/bugzilla/>
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.