[PATCH] recognize implied ranges for modulo.

Andrew MacLeod amacleod@redhat.com
Wed Nov 18 14:22:26 GMT 2020


On 11/18/20 3:35 AM, Aldy Hernandez wrote:
>
>
> On 11/17/20 11:01 PM, Andrew MacLeod wrote:
>> PR 91029 observes when
>>
>>   a % b > 0 && b >= 0,
>>
>> then a has an implied range of  a >=0.  likewise
>
> Shouldn't that be && b > 0?  b == 0 is undefined.
>
>
If you were folding, sure, but  I think its OK for equation solving.. 
whats important is that b is not negative.
  I can easily imagine having a positive LHS and an unknown unsigned 
value for b..   we could still conclude that 'a' is positive even though 
0 is in the "possible ranges" for 'b'

Andrew



More information about the Gcc-patches mailing list