http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49189
--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-27 11:21:09 UTC --- The old code did not re-fold in /* If we have (type) (a CMP b) and type is an integral type, return new expression involving the new type. */ if (COMPARISON_CLASS_P (op0) && INTEGRAL_TYPE_P (type)) return fold_build2_loc (loc, TREE_CODE (op0), type, TREE_OPERAND (op0, 0), TREE_OPERAND (op0, 1)); for BOOLEAN_TYPE. It could be argued that re-folding is never necessary here because the comparison does not depend on the type of the boolean result it produces. So I'll disable re-folding here.