re PR c/71583 (ICE on invalid code on x86_64-linux-gnu (in c_parser_postfix_expression_after_paren_type, at c/c-parser.c:8192))

PR c/71583
	* c-parser.c (c_parser_postfix_expression_after_paren_type): Also
	check expr.value.

	* gcc.dg/noncompile/pr71583.c: New test.

From-SVN: r238861
This commit is contained in:
Marek Polacek 2016-07-29 11:48:36 +00:00 committed by Marek Polacek
parent 0c4c49092a
commit a5b5c8b624
4 changed files with 23 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2016-07-29 Marek Polacek <polacek@redhat.com>
PR c/71583
* c-parser.c (c_parser_postfix_expression_after_paren_type): Also
check expr.value.
2016-07-22 Uros Bizjak <ubizjak@gmail.com>
* c-typeck.c: Use HOST_WIDE_INT_1 instead of (HOST_WIDE_INT) 1,

View File

@ -8232,7 +8232,9 @@ c_parser_postfix_expression_after_paren_type (c_parser *parser,
set_c_expr_source_range (&expr, init.src_range);
expr.original_code = ERROR_MARK;
expr.original_type = NULL;
if (type != error_mark_node && type_expr)
if (type != error_mark_node
&& expr.value != error_mark_node
&& type_expr)
{
if (TREE_CODE (expr.value) == C_MAYBE_CONST_EXPR)
{

View File

@ -3,6 +3,9 @@
PR c/71574
* c-c++-common/pr71574.c: New test.
PR c/71583
* gcc.dg/noncompile/pr71583.c: New test.
2016-07-29 Kugan Vivekanandarajah <kuganv@linaro.org>
PR middle-end/68217

View File

@ -0,0 +1,11 @@
/* PR c/71583 */
/* { dg-do compile } */
void
f (int i)
{
(int (*)[++i]) { int }; /* { dg-error "expected" } */
(int (*)[++i]) { }; /* { dg-error "empty" } */
(int (*)[++i]) { , }; /* { dg-error "expected" } */
(int (*)[++i]) { f () }; /* { dg-error "too few" } */
}