Diego Novillo <[EMAIL PROTECTED]> writes:

> This is happening in gcc.dg/tree-ssa/20040121-1.c.  The test
> specifically tests that (p!=0) + (q!=0) should be computed as
> int:
> 
> char *foo(char *p, char *q) {
>     int x = (p !=0) + (q != 0);
>     ...
> }
> 

...

> When we call int_const_binop to fold 'true' + 'true' it returns
> 'false', and so we end up with the range [0, 0] for x_12, which
> causes the test to fail.
> 
> I don't know who's at fault here.  VRP is doing exactly what the
> IL tells it to.  Is this program legal C?  Or should the FE emit
> casts to int here?

The program is legal C.  The _Bool values should be promoted to int
before doing the addition.  I guess that type cast is being lost
somewhere.

Ian

Reply via email to