aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-05-26 11:38:03 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-05-26 11:38:03 +0000
commit3d62b8954fa7186367425da751f8d8626077f09d (patch)
tree15cb292cd7fb736c9b1d1d89ddd72bc52e8b7efb /gcc/fold-const.c
parent2eb25c98ab88d63e27089a920f3fbd6fc485cd9e (diff)
downloadgcc-3d62b8954fa7186367425da751f8d8626077f09d.zip
gcc-3d62b8954fa7186367425da751f8d8626077f09d.tar.gz
gcc-3d62b8954fa7186367425da751f8d8626077f09d.tar.bz2
re PR middle-end/40252 (Internal compiler error on samba4 (verify_gimple failed))
2009-05-26 Richard Guenther <rguenther@suse.de> PR middle-end/40252 * fold-const.c (fold_binary): Use the correct types for building rotates. * gcc.c-torture/compile/pr40252.c: New testcase. From-SVN: r147867
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index e322ecb..03f6805 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -10175,8 +10175,12 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
&& TREE_INT_CST_HIGH (tree11) == 0
&& ((TREE_INT_CST_LOW (tree01) + TREE_INT_CST_LOW (tree11))
== TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg0, 0)))))
- return build2 (LROTATE_EXPR, type, TREE_OPERAND (arg0, 0),
- code0 == LSHIFT_EXPR ? tree01 : tree11);
+ return fold_convert (type,
+ build2 (LROTATE_EXPR,
+ TREE_TYPE (TREE_OPERAND (arg0, 0)),
+ TREE_OPERAND (arg0, 0),
+ code0 == LSHIFT_EXPR
+ ? tree01 : tree11));
else if (code11 == MINUS_EXPR)
{
tree tree110, tree111;
@@ -10190,10 +10194,12 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
(TREE_TYPE (TREE_OPERAND
(arg0, 0))))
&& operand_equal_p (tree01, tree111, 0))
- return build2 ((code0 == LSHIFT_EXPR
- ? LROTATE_EXPR
- : RROTATE_EXPR),
- type, TREE_OPERAND (arg0, 0), tree01);
+ return fold_convert (type,
+ build2 ((code0 == LSHIFT_EXPR
+ ? LROTATE_EXPR
+ : RROTATE_EXPR),
+ TREE_TYPE (TREE_OPERAND (arg0, 0)),
+ TREE_OPERAND (arg0, 0), tree01));
}
else if (code01 == MINUS_EXPR)
{
@@ -10208,10 +10214,12 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
(TREE_TYPE (TREE_OPERAND
(arg0, 0))))
&& operand_equal_p (tree11, tree011, 0))
- return build2 ((code0 != LSHIFT_EXPR
- ? LROTATE_EXPR
- : RROTATE_EXPR),
- type, TREE_OPERAND (arg0, 0), tree11);
+ return fold_convert (type,
+ build2 ((code0 != LSHIFT_EXPR
+ ? LROTATE_EXPR
+ : RROTATE_EXPR),
+ TREE_TYPE (TREE_OPERAND (arg0, 0)),
+ TREE_OPERAND (arg0, 0), tree11));
}
}
}