diff options
author | Richard Guenther <rguenther@suse.de> | 2006-07-05 15:49:12 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2006-07-05 15:49:12 +0000 |
commit | 30a843c33c55162e331f4ce1f0283abb34dc01a7 (patch) | |
tree | 0eda7a946181d1977412bfff3605f5b764f4ef03 /gcc | |
parent | e5d7f6f7358faa1ff7cf96d45b17bf07aa9fad6c (diff) | |
download | gcc-30a843c33c55162e331f4ce1f0283abb34dc01a7.zip gcc-30a843c33c55162e331f4ce1f0283abb34dc01a7.tar.gz gcc-30a843c33c55162e331f4ce1f0283abb34dc01a7.tar.bz2 |
re PR tree-optimization/28162 (ICE in set_value_range, at tree-vrp.c:157)
2006-07-05 Richard Guenther <rguenther@suse.de>
PR tree-optimization/28162
* fold-const.c (fold_binary): For (-A) * (-B) -> A * B
make sure to convert the operands to the correct type.
* gcc.dg/pr28162.c: New testcase.
From-SVN: r115202
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fold-const.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr28162.c | 17 |
4 files changed, 32 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ba7b529..798fe03 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-07-05 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/28162 + * fold-const.c (fold_binary): For (-A) * (-B) -> A * B + make sure to convert the operands to the correct type. + 2006-07-04 Paolo Bonzini <bonzini@gnu.org> PR tree-optimization/28218 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 5c592c3..008310c 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -8852,12 +8852,12 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) /* (-A) * (-B) -> A * B */ if (TREE_CODE (arg0) == NEGATE_EXPR && negate_expr_p (arg1)) return fold_build2 (MULT_EXPR, type, - TREE_OPERAND (arg0, 0), - negate_expr (arg1)); + fold_convert (type, TREE_OPERAND (arg0, 0)), + fold_convert (type, negate_expr (arg1))); if (TREE_CODE (arg1) == NEGATE_EXPR && negate_expr_p (arg0)) return fold_build2 (MULT_EXPR, type, - negate_expr (arg0), - TREE_OPERAND (arg1, 0)); + fold_convert (type, negate_expr (arg0)), + fold_convert (type, TREE_OPERAND (arg1, 0))); if (! FLOAT_TYPE_P (type)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 02e6dd1..e40ce0b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,4 +1,9 @@ 2006-07-05 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/28162 + * gcc.dg/pr28162.c: New testcase. + +2006-07-05 Richard Guenther <rguenther@suse.de> Andrew Pinski <pinskia@gcc.gnu.org> PR c++/27084 diff --git a/gcc/testsuite/gcc.dg/pr28162.c b/gcc/testsuite/gcc.dg/pr28162.c new file mode 100644 index 0000000..8bd28ad --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr28162.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +void Lag_max_wght(float corr[], long wght_flg) +{ + float t0, max; + const float *ww; + long i; + if ( wght_flg > 0 ) { + for ( i = 143; i >= 20; i-- ) { + t0 = corr[ - i] * *ww--; + if ( t0 >= max ) + max = t0; + } + } +} + |