https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77898
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |---
Summary|VR_RANGE with inverted |incorrect VR_ANTI_RANGE
|bounds after evrp and |after evrp and before vrp1
|before vrp1 |
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
I may have made a mistake and miread the VR_ANTI_RANGE as VR_RANGE here. Sorry
about that. I've adjusted the Summary.
I may also be confused about other things but below is what I see in GDB when I
call get_range_info() from plus_stmt_object_size() on the offset in
POINTER_PLUS_EXPR (get_offset_range is a function I've added in my patch for
bug 77608). As best I can tell the anti-range doesn't correspond to the range
of the variable i which is [0, 1].
Breakpoint 1, get_offset_range (op1=0x7ffff0daa990, offrange=0x7fffffffd360)
at /src/gcc/77608/gcc/tree-object-size.c:824
824 bool antirange = false;
(gdb) n
826 if (TREE_CODE (op1) == SSA_NAME)
(gdb) n
829 wide_int min, max;
(gdb) n
830 enum value_range_type range_type = get_range_info (op1, &min,
&max);
(gdb) n
831 if (range_type == VR_RANGE || (antirange = range_type ==
VR_ANTI_RANGE))
(gdb) p debug_tree(op1)
<ssa_name 0x7ffff0daa990
type <integer_type 0x7ffff0da41f8 sizetype public unsigned DI
size <integer_cst 0x7ffff0da0ca8 constant 64>
unit size <integer_cst 0x7ffff0da0cc0 constant 8>
align 64 symtab 0 alias set -1 canonical type 0x7ffff0da41f8 precision
64 min <integer_cst 0x7ffff0da0cd8 0> max <integer_cst 0x7ffff0db1480
18446744073709551615>>
static visited
def_stmt _2 = (sizetype) i_4;
version 2
ptr-info 0x7ffff0ec8f80>
$1 = void
(gdb) p range_type
$2 = VR_ANTI_RANGE
(gdb) p min
$3 = {<wide_int_storage> = {val = {2147483648, 18061790, 140737235423104},
len = 1, precision = 64}, static is_sign_extended = <optimized out>}
(gdb) p max
$4 = {<wide_int_storage> = {val = {-2147483649, 18061836, 140737235423104},
len = 1, precision = 64}, static is_sign_extended = <optimized out>}
(gdb) p debug_tree(gimple_assign_rhs1 (SSA_NAME_DEF_STMT (op1)))
<ssa_name 0x7ffff0daaa68
type <integer_type 0x7ffff0da47e0 int public SI
size <integer_cst 0x7ffff0da0ee8 constant 32>
unit size <integer_cst 0x7ffff0da0f00 constant 4>
align 32 symtab 0 alias set -1 canonical type 0x7ffff0da47e0 precision
32 min <integer_cst 0x7ffff0da0ea0 -2147483648> max <integer_cst 0x7ffff0da0eb8
2147483647>
pointer_to_this <pointer_type 0x7ffff0dbec78>>
visited var <parm_decl 0x7ffff0edc000 i>
def_stmt i_4 = PHI <i_5(D)(2), 0(3)>
version 4>