From e5165b604cb5af9ea1478b37194c1398204f61e3 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Fri, 27 Feb 2015 12:18:57 +0000 Subject: [PATCH] =?utf8?q?re=20PR=20c/65228=20(ICE:=20expected=20tree=20th?= =?utf8?q?at=20contains=20=E2=80=98decl=20minimal=E2=80=99=20structure,=20?= =?utf8?q?have=20=E2=80=98error=5Fmark=E2=80=99=20in=20start=5Fdecl)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit PR c/65228 * c-decl.c (start_decl): Return NULL_TREE if decl is an error node. * gcc.dg/pr65228.c: New test. From-SVN: r221056 --- gcc/c/ChangeLog | 5 +++++ gcc/c/c-decl.c | 4 ++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr65228.c | 11 +++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr65228.c diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 0bb5dc70600..7152fc0d6c1 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2015-02-27 Marek Polacek + + PR c/65228 + * c-decl.c (start_decl): Return NULL_TREE if decl is an error node. + 2015-02-14 Marek Polacek PR c/64768 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 8eeee9c53de..749785801ee 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -4460,8 +4460,8 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs, decl = grokdeclarator (declarator, declspecs, NORMAL, initialized, NULL, &attributes, &expr, NULL, deprecated_state); - if (!decl) - return 0; + if (!decl || decl == error_mark_node) + return NULL_TREE; if (expr) add_stmt (fold_convert (void_type_node, expr)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5ca86b107f8..93c5b0dc693 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-02-27 Marek Polacek + + PR c/65228 + * gcc.dg/pr65228.c: New test. + 2015-02-27 Kai Tietz PR c/35330 diff --git a/gcc/testsuite/gcc.dg/pr65228.c b/gcc/testsuite/gcc.dg/pr65228.c new file mode 100644 index 00000000000..fd8323876c2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr65228.c @@ -0,0 +1,11 @@ +/* PR c/65228 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +__auto_type a = b; /* { dg-error "undeclared" } */ + +void +f (void) +{ + __auto_type c = d; /* { dg-error "undeclared" } */ +} -- 2.30.2