[Bug tree-optimization/83312] [8 regression] bogus -Warray-bounds warning
law at redhat dot com
gcc-bugzilla@gcc.gnu.org
Fri Dec 8 06:47:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83312
Jeffrey A. Law <law at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |law at redhat dot com
Assignee|unassigned at gcc dot gnu.org |law at redhat dot com
--- Comment #4 from Jeffrey A. Law <law at redhat dot com> ---
It's actually not jump threading that figures things out here. VRP uses SCEV
to identify J as an induction variable. So during substitute_and_fold it
transforms the controlling conditional from:
Folding statement: if (j_9 < 0)
Folding predicate j_9 < 0 to 0
Folded into: if (0 != 0)
Which makes the path with the problem code unreachable before we even look at
jump threading. But the problem block still in the IL and it's considered
reachable.
I think we can avoid the warning by simply clearing EDGE_EXECUTABLE on the
appropriate edge when we simplify the conditional. That won't capture
secondary effects though. We could go further and have a step that propagates
EDGE_EXECUTABLE just before we do the array bounds warnings. I'm not sure if
it's worth the effort. Thoughts?
More information about the Gcc-bugs
mailing list