diff mbox

[GIMPLE,FE] replace calls to c_parser_gimple_unary_expression by c_parser_gimple_postfix_expression

Message ID CAAgBjMmd8M42u5adp_o=m=QiBK7=u7BDUzs8j5qi9N7=Mb4j9Q@mail.gmail.com
State New
Headers show

Commit Message

Prathamesh Kulkarni Feb. 8, 2017, 11:48 a.m. UTC
Hi,
The attached patch replaces couple of calls to c_parser_gimple_unary_expression
by c_parser_gimple_postfix_expression, to reject invalid cases like:
~t0_1 = ~a;
OK to commit after bootstrap+test ?

Thanks,
Prathamesh

Comments

Prathamesh Kulkarni Feb. 8, 2017, 11:51 a.m. UTC | #1
On 8 February 2017 at 17:18, Prathamesh Kulkarni
<prathamesh.kulkarni@linaro.org> wrote:
> Hi,

> The attached patch replaces couple of calls to c_parser_gimple_unary_expression

> by c_parser_gimple_postfix_expression, to reject invalid cases like:

> ~t0_1 = ~a;

> OK to commit after bootstrap+test ?

Oops no, this would reject valid cases like: *p = rhs.
>

> Thanks,

> Prathamesh
diff mbox

Patch

diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c
index 942597a..00809a5 100644
--- a/gcc/c/gimple-parser.c
+++ b/gcc/c/gimple-parser.c
@@ -268,7 +268,7 @@  c_parser_gimple_statement (c_parser *parser, gimple_seq *seq)
   tree arg = NULL_TREE;
   auto_vec<tree> vargs;
 
-  lhs = c_parser_gimple_unary_expression (parser);
+  lhs = c_parser_gimple_postfix_expression (parser);
   loc = EXPR_LOCATION (lhs.value);
   rhs.value = error_mark_node;
 
@@ -403,7 +403,7 @@  c_parser_gimple_statement (c_parser *parser, gimple_seq *seq)
       && c_parser_peek_2nd_token (parser)->type == CPP_OPEN_PAREN
       && lookup_name (c_parser_peek_token (parser)->value))
     {
-      rhs = c_parser_gimple_unary_expression (parser);
+      rhs = c_parser_gimple_postfix_expression (parser);
       if (rhs.value != error_mark_node)
 	{
 	  gimple *call = gimple_build_call_from_tree (rhs.value);