aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2007-07-12 10:27:51 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2007-07-12 10:27:51 +0000
commit8f20c485050d550ccca1f4f4ed05ffd249c57c5f (patch)
treeb01916e56bf1aadf986d4b4a11b1a17c5a1f24f0 /gcc/fold-const.c
parent44f51d597ed4102d6da3bd4cf631c5031b21c975 (diff)
downloadgcc-8f20c485050d550ccca1f4f4ed05ffd249c57c5f.zip
gcc-8f20c485050d550ccca1f4f4ed05ffd249c57c5f.tar.gz
gcc-8f20c485050d550ccca1f4f4ed05ffd249c57c5f.tar.bz2
gimplify.c (gimplify_conversion): Make sure that the result from maybe_fold_offset_to_reference is trivially...
2007-07-12 Richard Guenther <rguenther@suse.de> * gimplify.c (gimplify_conversion): Make sure that the result from maybe_fold_offset_to_reference is trivially convertible to the desired type before doing the simplification. (gimplify_expr): Likewise. * fold-const.c (fold_binary): Use the correct types for building the simplified expression. From-SVN: r126577
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 652fd17..bff4725 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -10271,7 +10271,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
if (integer_zerop (arg1))
return non_lvalue (fold_convert (type, arg0));
if (integer_all_onesp (arg1))
- return fold_build1 (BIT_NOT_EXPR, type, arg0);
+ return fold_build1 (BIT_NOT_EXPR, type, op0);
if (operand_equal_p (arg0, arg1, 0))
return omit_one_operand (type, integer_zero_node, arg0);
@@ -10865,7 +10865,8 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
"when distributing negation across "
"division"),
WARN_STRICT_OVERFLOW_MISC);
- return fold_build2 (code, type, TREE_OPERAND (arg0, 0),
+ return fold_build2 (code, type,
+ fold_convert (type, TREE_OPERAND (arg0, 0)),
negate_expr (arg1));
}
if ((!INTEGRAL_TYPE_P (type) || TYPE_OVERFLOW_UNDEFINED (type))