aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-02-27 13:17:17 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-02-27 13:17:17 +0000
commit7fb52af2ec381cc0f02219f0221042786c1f2cbd (patch)
tree31e4bf7768f1626b8eaf53fa5ed4d19b28cb9f34 /gcc/fold-const.c
parent47d430229389f7c10cdd18317192eb448e2ed989 (diff)
downloadgcc-7fb52af2ec381cc0f02219f0221042786c1f2cbd.zip
gcc-7fb52af2ec381cc0f02219f0221042786c1f2cbd.tar.gz
gcc-7fb52af2ec381cc0f02219f0221042786c1f2cbd.tar.bz2
re PR tree-optimization/25290 (PHI-OPT could be rewritten so that is uses fold)
2008-02-27 Richard Guenther <rguenther@suse.de> PR middle-end/25290 * fold-const.c (fold_unary): Return the correct argument, converted to the result type. * gcc.c-torture/execute/pr35390.c: New testcase. From-SVN: r132710
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index f6a73ef..987acf1 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -8340,7 +8340,7 @@ fold_unary (enum tree_code code, tree type, tree op0)
if (TREE_CODE (arg0) == INTEGER_CST)
return fold_not_const (arg0, type);
else if (TREE_CODE (arg0) == BIT_NOT_EXPR)
- return TREE_OPERAND (op0, 0);
+ return fold_convert (type, TREE_OPERAND (arg0, 0));
/* Convert ~ (-A) to A - 1. */
else if (INTEGRAL_TYPE_P (type) && TREE_CODE (arg0) == NEGATE_EXPR)
return fold_build2 (MINUS_EXPR, type,