------- Comment #4 from baldrick at free dot fr 2006-04-16 20:50 ------- Does this patch fix it for you? It looks more complicated than it is (most of the patch is comment tweaks and white space changes due to indentation change). The real change is to remove the check if (value_ranges_intersect_p (vr0, vr1)) for the case of VR_RANGE meet VR_RANGE. Also, rather than immediately setting the range to VR_VARYING if the interval endpoints cannot be compared at compile time, instead the no_meet logic is executed. If the endpoints can't be compared, then previously the call to value_ranges_intersect_p would return false, and control would pass to no_meet, so this preserves the previous logic, which matters for PR21090 for example.
When working in the lattic of intervals ordered by reverse set inclusion, the meet of two intervals A and B is, by definition, the smallest interval containing both A and B. [Normally this would be called the join rather than the meet, but it's the meet here because we consider smaller intervals to be bigger :)] This smallest interval is the convex hull of A and B, or in other words, if A=[a1,a2] and B=[b1,b2], then A meet B is [min(a1,a2), max(b1,b2)]. This is exactly the interval that vrp_meet calculates, except for some reason is only wants to calculate it if A and B intersect; if they don't intersect it gives up and goes all the way up to VR_VARYING. By removing the intersection check, vrp_meet now always calculates the convex hull of two VR_RANGEs. In your case, A=[0,0] and B=[3,3]. Because they don't intersect, before vrp_meet would return VR_VARYING, which amount to [-INF,INF]. Now it returns [0,3]. While I was there, I tweaked the comments to the other cases, like VR_ANTI_RANGE vs VR_ANTI_RANGE, because they are wrong, mathematically speaking. However, they are right in the case when each anti-range is just anti-one-point, like ~[0,0], which seems to be the main case of interest to VRP. That's the reason I didn't change the code. This patch survives a bootstrap with all default languages plus Ada. I ran the regression suite, but forgot to run it without this patch beforehand, so now I don't know if the failures are due to this patch or not, d'oh! -- baldrick at free dot fr changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |baldrick at free dot fr http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23744