------- Comment #8 from pinskia at gcc dot gnu dot org 2007-08-04 01:17 -------
Here is a full patch which fixes the type mismatch type ICE also:
Index: fold-const.c
===================================================================
--- ../../gcc/fold-const.c (revision 127190)
+++ ../../gcc/fold-const.c (working copy)
@@ -9730,15 +9730,19 @@ fold_binary (enum tree_code code, tree t
&& TREE_CODE (arg1) == BIT_AND_EXPR)
{
if (operand_equal_p (arg0, TREE_OPERAND (arg1, 1), 0))
- return fold_build2 (BIT_AND_EXPR, type,
- fold_build1 (BIT_NOT_EXPR, type,
- TREE_OPERAND (arg1, 0)),
- arg0);
+ {
+ tree arg10 = fold_convert (type, TREE_OPERAND (arg1, 0));
+ return fold_build2 (BIT_AND_EXPR, type,
+ fold_build1 (BIT_NOT_EXPR, type, arg10),
+ fold_convert (type, arg0));
+ }
if (operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0))
- return fold_build2 (BIT_AND_EXPR, type,
- fold_build1 (BIT_NOT_EXPR, type,
- TREE_OPERAND (arg1, 1)),
- arg0);
+ {
+ tree arg11 = fold_convert (type, TREE_OPERAND (arg1, 1));
+ return fold_build2 (BIT_AND_EXPR, type,
+ fold_build1 (BIT_NOT_EXPR, type, arg11),
+ fold_convert (type, arg0));
+ }
}
/* Fold (A & ~B) - (A & B) into (A ^ B) - B, where B is
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32780