aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-08-31 13:39:26 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-08-31 13:39:26 +0000
commit2b2587f577ebc08d489132307517f5bb9fb35346 (patch)
tree1b10c7db6ee3b9634eca1ea1b3b6e7593223402b /gcc/fold-const.c
parentfb2fed03b680e2421f24ed33e3ab7dc8f03797cc (diff)
downloadgcc-2b2587f577ebc08d489132307517f5bb9fb35346.zip
gcc-2b2587f577ebc08d489132307517f5bb9fb35346.tar.gz
gcc-2b2587f577ebc08d489132307517f5bb9fb35346.tar.bz2
re PR middle-end/37289 (ICE after non-trivial conversion at assignment)
2008-08-31 Richard Guenther <rguenther@suse.de> PR middle-end/37289 * fold-const.c (fold_binary): Retain conversions in folding ~A + 1 to -A. * gcc.dg/pr37289.c: New testcase. From-SVN: r139831
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index ae66ad4..561fb80 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -9498,7 +9498,8 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
/* Convert ~A + 1 to -A. */
if (TREE_CODE (arg0) == BIT_NOT_EXPR
&& integer_onep (arg1))
- return fold_build1 (NEGATE_EXPR, type, TREE_OPERAND (arg0, 0));
+ return fold_build1 (NEGATE_EXPR, type,
+ fold_convert (type, TREE_OPERAND (arg0, 0)));
/* ~X + X is -1. */
if (TREE_CODE (arg0) == BIT_NOT_EXPR