summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprathamesh3492 <prathamesh3492@138bc75d-0d04-0410-961f-82ee72b054a4>2017-02-19 09:14:38 +0000
committerprathamesh3492 <prathamesh3492@138bc75d-0d04-0410-961f-82ee72b054a4>2017-02-19 09:14:38 +0000
commit21bfe0d49e2ac9bfa4383ab4a0d057d737e344f6 (patch)
tree5c5905b9da3a7f3cf089cebbd089a94a5d0a6c3f
parenta8deddc865d2f08f69768b7ca43b765c577f43a2 (diff)
downloadgcc-21bfe0d49e2ac9bfa4383ab4a0d057d737e344f6.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245571 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/gimple-parser.c9
2 files changed, 15 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 0626973d47a..5cff63a24d1 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,5 +1,11 @@
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
FMA_EXPR.
diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c
index 31d0a08d303..cb2b6af0cb1 100644
--- a/gcc/c/gimple-parser.c
+++ b/gcc/c/gimple-parser.c
@@ -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)
@@ -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 ();