From: Marek Polacek Date: Fri, 27 Feb 2015 12:18:57 +0000 (+0000) Subject: re PR c/65228 (ICE: expected tree that contains ‘decl minimal’ structure, have ‘error... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e5165b604cb5af9ea1478b37194c1398204f61e3;p=gcc.git re PR c/65228 (ICE: expected tree that contains ‘decl minimal’ structure, have ‘error_mark’ in start_decl) 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 --- 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" } */ +}