On Fri, Nov 11, 2016 at 11:51:34AM -0700, Martin Sebor wrote:
> On 11/11/2016 10:53 AM, Richard Biener wrote:
> >On November 11, 2016 6:34:37 PM GMT+01:00, Martin Sebor <mse...@gmail.com> 
> >wrote:
> >>I noticed that variables of signed integer types that are constrained
> >>to a specific subrange of values of the type like so:
> >>
> >>     [-TYPE_MAX + N, N]
> >>
> >>are reported by get_range_info as the anti-range
> >>
> >>     [-TYPE_MAX, TYPE_MIN - 1]
> >>
> >>for all positive N of the type regardless of the variable's actual
> >>range.  Basically, such variables are treated the same as variables
> >>of the same type that have no range info associated with them at all
> >>(such as function arguments or global variables).
> >>
> >>For example, while a signed char variable between -1 and 126 is
> >>represented by
> >>
> >>     VR_ANTI_RANGE [127, -2]
> >
> >? I'd expect [-1, 126].  And certainly never range-min > range-max
> 
> Okay.  With this code:
> 
>   void f (void *d, const void *s, signed char i)
>   {
>     if (i < -1 || 126 < i) i = -1;
>     __builtin_memcpy (d, s, i);
>   }
> 
> I see the following in the output of -fdump-tree-vrp:
> 
>   prephitmp_11: ~[127, 18446744073709551614]
>   ...
>   # prephitmp_11 = PHI <_12(3), 18446744073709551615(2)>
>   __builtin_memcpy (d_8(D), s_9(D), prephitmp_11);

At some point get_range_info for anti-ranges has been represented
by using min larger than max, but later on some extra bit on SSA_NAME has
been added.  Dunno if the code has been adjusted at that point.

        Jakub

Reply via email to