This is the mail archive of the
mailing list for the GCC project.
VR_RANGE with inverted bounds
- From: Martin Sebor <msebor at gmail dot com>
- To: GCC Mailing List <gcc at gcc dot gnu dot org>
- Date: Fri, 7 Oct 2016 10:49:39 -0600
- Subject: VR_RANGE with inverted bounds
- Authentication-results: sourceware.org; auth=none
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?
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
void g (char *p, int i)
if (i < 0 || 1 < i)
i = 0;
p += i;