From: Roger Sayle Date: Tue, 28 Mar 2006 05:01:27 +0000 (+0000) Subject: re PR middle-end/22524 (fold (or the front-ends) produces UNARY (BIT_NOT_EXPR) tree... X-Git-Tag: releases/gcc-4.2.0~3537 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7f166b0a8e4cf02f0e297429471ab95078820a48;p=thirdparty%2Fgcc.git 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) : Call fold_convert to cast BIT_NOT_EXPR operand to the correct type. From-SVN: r112438 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b8a8a7d59fab..f57f710a61db 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-03-27 Roger Sayle + + PR middle-end/22524 + * fold-const.c (fold_binary) : Call fold_convert to + cast BIT_NOT_EXPR operand to the correct type. + 2006-03-27 Sebastian Pop * tree-loop-linear.c: Don't include varray.h. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 9ea3232d4f7f..1381184f115c 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)