]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/22524 (fold (or the front-ends) produces UNARY (BIT_NOT_EXPR) tree...
authorRoger Sayle <roger@eyesopen.com>
Tue, 28 Mar 2006 05:01:27 +0000 (05:01 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Tue, 28 Mar 2006 05:01:27 +0000 (05:01 +0000)
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

gcc/ChangeLog
gcc/fold-const.c

index b8a8a7d59fab11bd7518d41ec20bc905e62d4d19..f57f710a61db646a1c8d74998bc72bac5b7eb295 100644 (file)
@@ -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.
index 9ea3232d4f7ffd9a35b57c6b6abf0fd6b0c86b30..1381184f115c9039038d525bb913d397419bc30a 100644 (file)
@@ -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)