On Fri, Mar 04, 2016 at 07:27:51AM +0100, Jakub Jelinek wrote:
> The difference is that c_parser_cast_expression can parse (type)...,
> ++..., --..., &..., +..., -..., *..., ~..., !..., &&...,
> sizeof/alignof/__extension__/__real/__imag/__transaction_{atomic,relaxed}...
> Perhaps even safer version would be:
>     if (c_parser_next_token_is (parser, CPP_OPEN_PAREN)
>         && c_token_starts_typename (c_parser_peek_2nd_token (parser)))
>       {
>       ... error handling ...
>       }
>     else
>       ... c_parser_postfix_expression (parser);

This occurred to me too, but I found that too ugly, and I'm not even sure it
prevents other possible ICEs.  Plus we'd need to put this new check into three
places, so I dropped this idea.

> But, even c_parser_postfix_expression parses tons of expressions that
> aren't allowed there, so I think it is overkill.  It needs to check
> afterwards, and from what I can see that happens in cilk_set_spawn_marker.
> Thus I think c_parser_cast_expression is safe, it parses perhaps more
> unexpected expressions, but will reject them all anyway, because they aren't
> CALL_EXPR after parsing.

Yeah, that's right.

        Marek

Reply via email to