http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49234
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |manu at gcc dot gnu.org --- Comment #9 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2013-02-28 20:40:55 UTC --- (In reply to comment #3) > 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 } > (In reply to comment #8) > > Does this seem like an approach worth exploring (this silences the warning), > or > does anyone have a better suggestion? Isn't the problem that vrp_var_may_overflow returns true even though 'state' cannot overflow? Jakub says: > 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. Couldn't be possible to detect this by the fact that 'state' does not depend on anything variable? Also, in such a case, the algorithm cannot iterate more than the number of phi nodes in the loop (if I understand the VRP correctly, which I most likely don't). But I looked around and I honestly don't know how to implement this idea. In any case, your patch would need to adjust the code for the minimum also, no? Because the same behaviour can be triggered just by using negative numbers to trigger a negative overflow infinity.