Skip to content

Commit

Permalink
2017-02-19 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Browse files Browse the repository at this point in the history
	* gimple-parser.c (c_parser_gimple_postfix_expression): Check return
	value of c_parser_parse_ssa_name against error_mark_node and emit
	error if ssa name is anonymous and written as default definition.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245571 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
prathamesh3492 committed Feb 19, 2017
1 parent a8deddc commit 21bfe0d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gcc/c/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2017-02-19 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>

* gimple-parser.c (c_parser_gimple_postfix_expression): Check return
value of c_parser_parse_ssa_name against error_mark_node and emit
error if ssa name is anonymous and written as default definition.

2017-02-19 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>

* gimple-parser.c (c_parser_gimple_postfix_expression): Handle
Expand Down
9 changes: 9 additions & 0 deletions gcc/c/gimple-parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,8 @@ c_parser_gimple_postfix_expression (c_parser *parser)
c_parser_consume_token (parser);
expr.value = c_parser_parse_ssa_name (parser, id, NULL_TREE,
version, ver_offset);
if (expr.value == error_mark_node)
return expr;
set_c_expr_source_range (&expr, tok_range);
/* For default definition SSA names. */
if (c_parser_next_token_is (parser, CPP_OPEN_PAREN)
Expand All @@ -900,6 +902,13 @@ c_parser_gimple_postfix_expression (c_parser *parser)
c_parser_consume_token (parser);
if (! SSA_NAME_IS_DEFAULT_DEF (expr.value))
{
if (!SSA_NAME_VAR (expr.value))
{
error_at (loc, "anonymous SSA name cannot have"
" default definition");
expr.value = error_mark_node;
return expr;
}
set_ssa_default_def (cfun, SSA_NAME_VAR (expr.value),
expr.value);
SSA_NAME_DEF_STMT (expr.value) = gimple_build_nop ();
Expand Down

0 comments on commit 21bfe0d

Please sign in to comment.