------- Comment #5 from pinskia at gcc dot gnu dot org 2007-11-03 18:52 ------- The patch to fix the bug: Index: ../../gcc/fold-const.c =================================================================== --- ../../gcc/fold-const.c (revision 129871) +++ ../../gcc/fold-const.c (working copy) @@ -11709,12 +11709,12 @@ fold_binary (enum tree_code code, tree t /* bool_var != 1 becomes !bool_var. */ if (TREE_CODE (TREE_TYPE (arg0)) == BOOLEAN_TYPE && integer_onep (arg1) && code == NE_EXPR) - return fold_build1 (TRUTH_NOT_EXPR, type, arg0); + return fold_build1 (TRUTH_NOT_EXPR, type, fold_convert (type, arg0));
/* bool_var == 0 becomes !bool_var. */ if (TREE_CODE (TREE_TYPE (arg0)) == BOOLEAN_TYPE && integer_zerop (arg1) && code == EQ_EXPR) - return fold_build1 (TRUTH_NOT_EXPR, type, arg0); + return fold_build1 (TRUTH_NOT_EXPR, type, fold_convert (type, arg0)); /* If this is an equality comparison of the address of two non-weak, unaliased symbols neither of which are extern (since we do not -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32931