GIMPLEFE: handle invalid __MEM

gcc/c/

	PR testsuite/80580
	* gimple-parser.c (c_parser_gimple_postfix_expression): Handle
	incorrect __MEM syntax.

gcc/testsuite/

	PR testsuite/80580
	* gcc.dg/gimplefe-error-5.c: New test.

From-SVN: r247900
This commit is contained in:
Mikhail Maltsev 2017-05-11 10:55:52 +00:00 committed by Mikhail Maltsev
parent ac4eb40f5c
commit 67ac9a9db1
4 changed files with 28 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2017-05-11 Mikhail Maltsev <maltsevm@gmail.com>
PR testsuite/80580
* gimple-parser.c (c_parser_gimple_postfix_expression): Handle
incorrect __MEM syntax.
2017-05-11 Mikhail Maltsev <maltsevm@gmail.com>
PR testsuite/80580

View File

@ -804,6 +804,16 @@ c_parser_gimple_postfix_expression (c_parser *parser)
}
}
ptr = c_parser_gimple_unary_expression (parser);
if (ptr.value == error_mark_node
|| ! POINTER_TYPE_P (TREE_TYPE (ptr.value)))
{
if (ptr.value != error_mark_node)
error_at (ptr.get_start (),
"invalid type of %<__MEM%> operand");
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
"expected %<)%>");
return expr;
}
if (! alias_type)
alias_type = TREE_TYPE (ptr.value);
/* Optional constant offset. */

View File

@ -1,3 +1,8 @@
2017-05-11 Mikhail Maltsev <maltsevm@gmail.com>
PR testsuite/80580
* gcc.dg/gimplefe-error-5.c: New test.
2017-05-11 Mikhail Maltsev <maltsevm@gmail.com>
PR testsuite/80580

View File

@ -0,0 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-fgimple" } */
__GIMPLE() void a()
{
__MEM() = 0; /* { dg-error "expected .<." } */
}