https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117222

--- Comment #8 from Andrew Macleod <amacleod at redhat dot com> ---
pointer_diff depends on range_operator::fold_range to do the generic fold,
which invokes wi_fold on subranges.  It also in turn invokes
op1_op2_relation_effect.

This worked fine when pointers were implemented with irange, but when the
transition to prange was made, a new version of fold_range is invoked by
dispatch which uses prange operators. The default fold_range for prange does
nothing, expecting the few operators which need it to implement their own
fold_range.  As a result all calls to fold_range for pointer_diff were
returning false, which translates to VARYING.

This PR demonstrates a dependency on knowing the relation between the operands
is VREL_NE, in which case pointer_diff should return a non-zero result instead
of varying.  The upcoming patch implements the pointer_diff version of
fold_range which then invokes the appropriate op1_op2_relation_effect ()
routine.  This will in turn will cause the result to be non-zero as expected.

Reply via email to