Commit 67ac9a9d by Mikhail Maltsev Committed by Mikhail Maltsev

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
parent ac4eb40f
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
* gimple-parser.c (c_parser_gimple_unary_expression): Check argument
type of unary '*'.
......
......@@ -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. */
......
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
* gcc.dg/gimplefe-error-4.c: New test.
2017-05-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
......
/* { dg-do compile } */
/* { dg-options "-fgimple" } */
__GIMPLE() void a()
{
__MEM() = 0; /* { dg-error "expected .<." } */
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment