aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorAndrew Pinski <andrew_pinski@playstation.sony.com>2007-08-04 05:21:30 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2007-08-03 22:21:30 -0700
commit4807562387b8ccd63477509c585739ed5c707b31 (patch)
treedd143a45c0ea4ee40bb1d05ffa346fe1e2ebb11f /gcc/fold-const.c
parentd531cdb15c6da4ea13e95a2d2332d2aeabddbe05 (diff)
downloadgcc-4807562387b8ccd63477509c585739ed5c707b31.zip
gcc-4807562387b8ccd63477509c585739ed5c707b31.tar.gz
gcc-4807562387b8ccd63477509c585739ed5c707b31.tar.bz2
re PR middle-end/32780 (ICE in extract_range_from_binary_expr, at tree-vrp.c:1793 at -O2 or higher)
2007-08-04 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/32780 * fold-const.c (fold_binary <case MINUS_EXPR>): Fix the type of operands for the folding of "A - (A & B)" into "~B & A"; cast them to type. 2007-08-04 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/32780 * gcc.c-torture/compile/pr32780.c: New test. From-SVN: r127199
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index be46b23..154454a 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -9730,15 +9730,19 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
&& TREE_CODE (arg1) == BIT_AND_EXPR)
{
if (operand_equal_p (arg0, TREE_OPERAND (arg1, 1), 0))
- return fold_build2 (BIT_AND_EXPR, type,
- fold_build1 (BIT_NOT_EXPR, type,
- TREE_OPERAND (arg1, 0)),
- arg0);
+ {
+ tree arg10 = fold_convert (type, TREE_OPERAND (arg1, 0));
+ return fold_build2 (BIT_AND_EXPR, type,
+ fold_build1 (BIT_NOT_EXPR, type, arg10),
+ fold_convert (type, arg0));
+ }
if (operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0))
- return fold_build2 (BIT_AND_EXPR, type,
- fold_build1 (BIT_NOT_EXPR, type,
- TREE_OPERAND (arg1, 1)),
- arg0);
+ {
+ tree arg11 = fold_convert (type, TREE_OPERAND (arg1, 1));
+ return fold_build2 (BIT_AND_EXPR, type,
+ fold_build1 (BIT_NOT_EXPR, type, arg11),
+ fold_convert (type, arg0));
+ }
}
/* Fold (A & ~B) - (A & B) into (A ^ B) - B, where B is