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

--- Comment #7 from Andrew Macleod <amacleod at redhat dot com> ---
Created attachment 54269
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54269&action=edit
patch in testing

Patch is in testing.

We added relation processing to GORI during stage 1, but its very lightly used
as we haven't fleshed out a lot of cases.  I found a couple of minor issues
with it, which I will fix in this patch.

Furthermore, there was no op2_range implementation for pointer plus.  Normally
this is all that would have been needed.  I added it and this testcase should
now work.  At least the ranges for the offset to pointer_plus now reflect zero
or nonzero based on known equality/inequality of the 2 operands. ie:


    <bb 2> :
    _1 = (sizetype) off_5(D);
    q_7 = p_6(D) + _1;
    if (p_6(D) != q_7)
      goto <bb 3>; [INV]
    else
      goto <bb 4>; [INV]

_1 : [irange] sizetype [0, 2147483647][18446744071562067968, +INF]
2->3  (T) _1 :  [irange] sizetype [1, 2147483647][18446744071562067968, +INF]
2->3  (T) off_5(D) :    [irange] int [-INF, -1][1, +INF]
2->4  (F) _1 :  [irange] sizetype [0, 0] NONZERO 0x0
2->4  (F) off_5(D) :    [irange] int [0, 0] NONZERO 0x0


Check and see if it also resolves the original test.  It does update the
zero/nonzero outgoing ranges.

Reply via email to