This is the mail archive of the
mailing list for the GCC project.
Re: VR_RANGE with inverted bounds
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Martin Sebor <msebor at gmail dot com>,GCC Mailing List <gcc at gcc dot gnu dot org>
- Date: Fri, 07 Oct 2016 19:15:23 +0200
- Subject: Re: VR_RANGE with inverted bounds
- Authentication-results: sourceware.org; auth=none
- References: <firstname.lastname@example.org>
On October 7, 2016 6:49:39 PM GMT+02:00, Martin Sebor <email@example.com> wrote:
>While processing the (p += i) expression below to validate the bounds
>of the pointer in I call get_range_info for i (in tree-object-size.c).
>The function returns the following VR_RANGE: [2147483648, -2147483649]
>rather than the expected [0, 1]. Is such a range to be expected or
>is it a bug?
This range is not valid (unless unsigned and you show it as signed).
>In general, what assumptions can I safely make about the bounds for
>VR_RANGE and VR_ANTI_RANGE? For example, besides being inverted like
>in this example, can the bounds also ever be the same? I don't think
>I have seen them be the same but I think I have seen a case where the
>variable's effective range was [X, X] (i.e., it was equal to
>a constant) and get_range_info returned VR_VARYING. Should that also
Tree-vrp. Has various assertions in its lattice update function which should hold for all ranges.
> void g (char *p, int i)
> if (i < 0 || 1 < i)
> i = 0;
> p += i;