[patch] tree-vrp.c: Avoid VR_ANTI_RANGE in a binary expression.

Andrew Pinski pinskia@physics.uc.edu
Wed Jun 22 15:32:00 GMT 2005


On Jun 22, 2005, at 11:21 AM, Diego Novillo wrote:

> On Tue, Jun 21, 2005 at 10:25:42AM -0400, Kazu Hirata wrote:
>
>> Tested on x86_64-pc-linux-gnu.  OK to apply?
>>
> No.  ~[0,0] * ~[0,0] == ~[0,0].
>
> Your test needs to be less broad.  It will probably be sufficient
> to do this inside the handler for PLUS_EXPR.

It is also MINUS_EXPR too.
Wrong, this is also miscompiled as unsigned overflow is defined:
unsigned int f(unsigned char a, unsigned  char b)
{
   unsigned char c;
   if (a != 0)
    if (b != 0)
     {
      c = ((unsigned)a)*((unsigned)b);
      printf("c=%d\n", c);
      if (c!=0)
       abort();
     }
}

int main(void)
{
   f(0x80,0x80);
   return 0;
}

Thanks,
Andrew Pinski



More information about the Gcc-patches mailing list