From a5b5c8b62494c0089bfc60ad5dfeae4e7f4c6690 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Fri, 29 Jul 2016 11:48:36 +0000 Subject: [PATCH] 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 --- gcc/c/ChangeLog | 6 ++++++ gcc/c/c-parser.c | 4 +++- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.dg/noncompile/pr71583.c | 11 +++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/noncompile/pr71583.c diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index b1c42ff4ca5..a47b8a3b5ed 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2016-07-29 Marek Polacek + + PR c/71583 + * c-parser.c (c_parser_postfix_expression_after_paren_type): Also + check expr.value. + 2016-07-22 Uros Bizjak * c-typeck.c: Use HOST_WIDE_INT_1 instead of (HOST_WIDE_INT) 1, diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 8952bca363a..a86cae29940 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -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) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9960fb0c4ac..c1df9e98b1a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 PR middle-end/68217 diff --git a/gcc/testsuite/gcc.dg/noncompile/pr71583.c b/gcc/testsuite/gcc.dg/noncompile/pr71583.c new file mode 100644 index 00000000000..5045b88b6af --- /dev/null +++ b/gcc/testsuite/gcc.dg/noncompile/pr71583.c @@ -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" } */ +}