[Bug tree-optimization/49234] [4.4/4.5/4.7/4.7 Regression] -Wstrict-overflow gives obviously unwarranted warning
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue May 31 09:06:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49234
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-31 09:02:29 UTC ---
We hit:
163724 rguenth /* Similarly, if the new maximum is smaller or larger
than
163724 rguenth the previous one, go all the way to +INF. */
163724 rguenth if (cmp_max < 0 || cmp_max > 0)
163724 rguenth {
163724 rguenth if (!needs_overflow_infinity (TREE_TYPE
(vr_result.max))
163724 rguenth || !vrp_var_may_overflow (lhs, phi))
163724 rguenth vr_result.max = TYPE_MAX_VALUE (TREE_TYPE
(vr_result.max));
163724 rguenth else if (supports_overflow_infinity (TREE_TYPE
(vr_result.max)))
163724 rguenth vr_result.max =
163724 rguenth positive_overflow_infinity (TREE_TYPE
(vr_result.max));
163724 rguenth }
As the IV (i) might overflow, vrp_var_may_overflow returns true.
In particular, chrec is SCEV_NOT_KNOWN. Thus it just in case sets
vr_result.max to +INF(OVF) and later on we warn about it.
Before hitting this code, vr_result contains the right range [0, 2], but it
doesn't know it can safely use that.
More information about the Gcc-bugs
mailing list