> > On Fri, May 27, 2005 at 02:32:46PM -0400, Andrew Pinski wrote: > > > > > > 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); > > > ... > > > } > > > > > > During VRP, we get this IL > > > > > > D.1294_10 = first_8 != 0B; > > > D.1295_11 = last_9 != 0B; > > > x_12 = D.1294_10 + D.1295_11; > > For me (on the mainline as of last night), > > both D.1294 and D.1295 are of type int so it > > looks like a bug in VRP assuming the resulting > > type of a comparison will a boolean type. > > > Of course they are both of type int, but the *value* they hold is > of type _Bool. > > When we call int_const_binop, we send the *values* and it > computes the operation using the type of the *values*. > > The workaround I am using right now is for VRP to force the type > of the values to the type of the expression. But that doesn't > fix the FE bug.
Are you sure, the NE_EXPR does not have a type of INTEGER_TYPE? This sounds like a missing fold_convert somewhere. -- Pinski