We shouldn't use the type of the operand but the type requested. This otherwise triggers asserts for (eq @0 @1) which requires boolean type, not whatever type @0 has.
Applied. Richard. 2014-08-19 Richard Biener <rguent...@suse.de> * genmatch.c (dt_simplify::gen_generic): Properly use the specified type to generate the outermost expression. Index: gcc/genmatch.c =================================================================== --- gcc/genmatch.c (revision 214097) +++ gcc/genmatch.c (working copy) @@ -1787,7 +1787,7 @@ dt_simplify::gen_generic (FILE *f) } /* Re-fold the toplevel result. */ if (e->operation->op->kind == id_base::CODE) - fprintf (f, " return fold_build%d (%s, TREE_TYPE (res_op0)", + fprintf (f, " return fold_build%d (%s, type", e->ops.length (), e->operation->op->id); else fprintf (f, " return build_call_expr (builtin_decl_implicit (%s), %d",