diff options
author | Roger Sayle <roger@eyesopen.com> | 2006-03-28 05:01:27 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2006-03-28 05:01:27 +0000 |
commit | 7f166b0a8e4cf02f0e297429471ab95078820a48 (patch) | |
tree | faf38ab8b2080959462409d0851aaa78fa99f809 /gcc | |
parent | ebf78a479a937efd39bc19511cb20a8b0796c922 (diff) | |
download | gcc-7f166b0a8e4cf02f0e297429471ab95078820a48.zip gcc-7f166b0a8e4cf02f0e297429471ab95078820a48.tar.gz gcc-7f166b0a8e4cf02f0e297429471ab95078820a48.tar.bz2 |
re PR middle-end/22524 (fold (or the front-ends) produces UNARY (BIT_NOT_EXPR) tree with mismatch types)
PR middle-end/22524
* fold-const.c (fold_binary) <MINUS_EXPR>: Call fold_convert to
cast BIT_NOT_EXPR operand to the correct type.
From-SVN: r112438
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fold-const.c | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b8a8a7d..f57f710 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-03-27 Roger Sayle <roger@eyesopen.com> + + PR middle-end/22524 + * fold-const.c (fold_binary) <MINUS_EXPR>: Call fold_convert to + cast BIT_NOT_EXPR operand to the correct type. + 2006-03-27 Sebastian Pop <pop@cri.ensmp.fr> * tree-loop-linear.c: Don't include varray.h. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 9ea3232..1381184 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -8186,7 +8186,8 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) if (INTEGRAL_TYPE_P (type) && TREE_CODE (arg0) == NEGATE_EXPR && integer_onep (arg1)) - return fold_build1 (BIT_NOT_EXPR, type, TREE_OPERAND (arg0, 0)); + return fold_build1 (BIT_NOT_EXPR, type, + fold_convert (type, TREE_OPERAND (arg0, 0))); /* Convert -1 - A to ~A. */ if (INTEGRAL_TYPE_P (type) |