diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-12 10:27:51 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-12 10:27:51 +0000 |
commit | 299888457f91c854ff9ce63d1cd004d7d7df1bc1 (patch) | |
tree | b01916e56bf1aadf986d4b4a11b1a17c5a1f24f0 /gcc/fold-const.c | |
parent | 235835a0f3a5216518cc45e50836b3a268f06238 (diff) | |
download | ppe42-gcc-299888457f91c854ff9ce63d1cd004d7d7df1bc1.tar.gz ppe42-gcc-299888457f91c854ff9ce63d1cd004d7d7df1bc1.zip |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126577 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 652fd177fba..bff47251c8a 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)) |