Message ID | 20110103143300.GC16156@tyan-ft48-01.lab.bos.redhat.com |
---|---|
State | New |
Headers | show |
On 01/03/11 07:33, Jakub Jelinek wrote: > Hi! > > My recent tree-ssa-ccp.c change broke the following testcase. > It is correct that the type used is the lhs type, but uns > needs to be taken from r1type instead of type, at least for the comparisons. > For non-comparisons I believe it ought to be the same as type (or uselessly > convertible to it) and most of the callers pass the exactly same type > to that function for both type and r1type anyway. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > 2011-01-03 Jakub Jelinek<jakub@redhat.com> > > PR tree-optimization/47155 > * tree-ssa-ccp.c (bit_value_binop_1): Use r1type instead of type > when computing uns. > > * gcc.c-torture/execute/pr47155.c: New test. OK. Jeff
On Mon, Jan 3, 2011 at 6:33 AM, Jakub Jelinek <jakub@redhat.com> wrote: > Hi! > > My recent tree-ssa-ccp.c change broke the following testcase. > It is correct that the type used is the lhs type, but uns > needs to be taken from r1type instead of type, at least for the comparisons. > For non-comparisons I believe it ought to be the same as type (or uselessly > convertible to it) and most of the callers pass the exactly same type > to that function for both type and r1type anyway. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > 2011-01-03 Jakub Jelinek <jakub@redhat.com> > > PR tree-optimization/47155 > * tree-ssa-ccp.c (bit_value_binop_1): Use r1type instead of type > when computing uns. > This caused: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538
--- gcc/tree-ssa-ccp.c.jj 2011-01-03 09:54:28.000000000 +0100 +++ gcc/tree-ssa-ccp.c 2011-01-03 10:19:06.000000000 +0100 @@ -1764,8 +1764,8 @@ bit_value_binop_1 (enum tree_code code, tree r1type, double_int r1val, double_int r1mask, tree r2type, double_int r2val, double_int r2mask) { - bool uns = (TREE_CODE (type) == INTEGER_TYPE - && TYPE_IS_SIZETYPE (type) ? 0 : TYPE_UNSIGNED (type)); + bool uns = (TREE_CODE (r1type) == INTEGER_TYPE + && TYPE_IS_SIZETYPE (r1type) ? 0 : TYPE_UNSIGNED (r1type)); /* Assume we'll get a constant result. Use an initial varying value, we fall back to varying in the end if necessary. */ *mask = double_int_minus_one; --- gcc/testsuite/gcc.c-torture/execute/pr47155.c.jj 2011-01-03 10:27:55.000000000 +0100 +++ gcc/testsuite/gcc.c-torture/execute/pr47155.c 2011-01-03 10:27:38.000000000 +0100 @@ -0,0 +1,14 @@ +/* PR tree-optimization/47155 */ + +unsigned int a; +static signed char b = -127; +int c = 1; + +int +main (void) +{ + a = b <= (unsigned char) (-6 * c); + if (!a) + __builtin_abort (); + return 0; +}