For a misplaced :s like (simplify (plus (minus@1:s @1 @2) (minus @2 @0)) (plus @1 @0))
we were giving test.pd:2:16 error: not implemented: predicate on leaf operand (plus (minus@1:s @1 @2) (minus @2 @0)) ^ which is at least confusing. The following patch improves this to test.pd:2:16 error: expected expression operand (plus (minus@1:s @1 @2) (minus @2 @0)) ^ also handling any other garbage after operands and rejecting test.pd:2:21 error: expected expression operand (plus (minus:s@1 @1@2) (minus @2 @0)) ^ which was previously accepted. Bootstrap on x86_64-unknown-linux-gnu in progress, no changes in generated files. Richard. 2015-09-17 Richard Biener <rguent...@suse.de> * genmatch.c (parser::parse_expr): Improve error message for mis-placed flags. Index: gcc/genmatch.c =================================================================== --- gcc/genmatch.c (revision 227779) +++ gcc/genmatch.c (working copy) @@ -3857,6 +3858,9 @@ parser::parse_expr () e->expr_type = expr_type; return op; } + else if (!(token->flags & PREV_WHITE)) + fatal_at (token, "expected expression operand"); + e->append_op (parse_op ()); } while (1);