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

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

I *think* this is correct.   but wrapv and signed stuff sometimes confuses me
:-)
when -fwrapv is on,  +INf - -INF is -1 ?  is this correct?
in which case, the relations that were being added for minus were not quite
correct in this case.

given    lhs = op1 - op2
if op1 > op2, we were producing a range of [1, +INF].  which is fine for
unsigned.   but for signed, that edge condition for -INF means the range should
be [0, +INF].
likewise, if op1 >= op2, then result range would be [0, +INF]

Is this is correct?   I hope that  -INF - -INF still equals 0 tho?  Thats the
only other case that might need consideration.

The attached patch implements the above and appears to fix the test. I just
want to be sure I have it right.

Reply via email to