aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenth@gcc.gnu.org>2005-06-01 18:51:12 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2005-06-01 18:51:12 +0000
commit3bedcc89670bc73c0fb92eeaab266173b8babb73 (patch)
tree24f4bde2341e587a951bda16272b126c8743ed39 /gcc/fold-const.c
parent095ecc24ec1340eb0f3d1f06f5bf627001b51d32 (diff)
downloadgcc-3bedcc89670bc73c0fb92eeaab266173b8babb73.zip
gcc-3bedcc89670bc73c0fb92eeaab266173b8babb73.tar.gz
gcc-3bedcc89670bc73c0fb92eeaab266173b8babb73.tar.bz2
stmt.c (expand_case): Use build_int_cst.
2005-06-01 Richard Guenther <rguenth@gcc.gnu.org> * stmt.c (expand_case): Use build_int_cst. (node_has_low_bound): Likewise, and correct type mismatch. (node_has_high_bound): Likewise. * fold-const.c (fold_binary): Ensure we build trees with the correct types - undo what STRIP_NOPS possibly did. From-SVN: r100459
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index ad5039b..05e016a 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -7948,7 +7948,9 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
&& (TREE_CODE (arg1) != REAL_CST
|| REAL_VALUE_NEGATIVE (TREE_REAL_CST (arg1))))
|| (INTEGRAL_TYPE_P (type) && flag_wrapv && !flag_trapv)))
- return fold_build2 (PLUS_EXPR, type, arg0, negate_expr (arg1));
+ return fold_build2 (PLUS_EXPR, type,
+ fold_convert (type, arg0),
+ fold_convert (type, negate_expr (arg1)));
/* Try folding difference of addresses. */
{
@@ -8467,7 +8469,8 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
if (exact_real_inverse (TYPE_MODE(TREE_TYPE(arg0)), &r))
{
tem = build_real (type, r);
- return fold_build2 (MULT_EXPR, type, arg0, tem);
+ return fold_build2 (MULT_EXPR, type,
+ fold_convert (type, arg0), tem);
}
}
}