This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Committed] PR middle-end/22524: Type mismatch in fold_binary
- From: Roger Sayle <roger at eyesopen dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 27 Mar 2006 21:43:54 -0700 (MST)
- Subject: [Committed] PR middle-end/22524: Type mismatch in fold_binary
The following patch fixes PR middle-end/22524, by adding an explicit
call to fold_convert to fold_binary to prevent creating a BIT_NOT_EXPR
with mismatched types.
The following patch has tested on i686-pc-linux-gnu with a full
"make bootstrap", all default languages, and regression tested with
a top-level "make -k check" with no new failures.
Committed to mainline as revision 112438.
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.
Index: fold-const.c
===================================================================
*** fold-const.c (revision 112147)
--- fold-const.c (working copy)
*************** fold_binary (enum tree_code code, tree t
*** 8186,8192 ****
if (INTEGRAL_TYPE_P (type)
&& TREE_CODE (arg0) == NEGATE_EXPR
&& integer_onep (arg1))
! return fold_build1 (BIT_NOT_EXPR, type, TREE_OPERAND (arg0, 0));
/* Convert -1 - A to ~A. */
if (INTEGRAL_TYPE_P (type)
--- 8186,8193 ----
if (INTEGRAL_TYPE_P (type)
&& TREE_CODE (arg0) == NEGATE_EXPR
&& integer_onep (arg1))
! return fold_build1 (BIT_NOT_EXPR, type,
! fold_convert (type, TREE_OPERAND (arg0, 0)));
/* Convert -1 - A to ~A. */
if (INTEGRAL_TYPE_P (type)
Roger
--