From: Marek Polacek Date: Fri, 27 Feb 2015 12:24:02 +0000 (+0000) Subject: re PR c/65228 (ICE: expected tree that contains ‘decl minimal’ structure, have ‘error... X-Git-Tag: releases/gcc-4.9.3~312 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71fac736da79e956950c462b6b0f4491a893623f;p=thirdparty%2Fgcc.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: r221057 --- diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 00c54492d6a7..0fc999caaee2 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,11 @@ +2015-02-27 Marek Polacek + + Backported from mainline + 2015-02-27 Marek Polacek + + PR c/65228 + * c-decl.c (start_decl): Return NULL_TREE if decl is an error node. + 2015-02-11 Jakub Jelinek PR c/64824 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 47907d5ec7fc..df88edb84702 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -4067,8 +4067,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 5a5924b312ed..bb0f9cf8a1ac 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2015-02-27 Marek Polacek + + Backported from mainline + 2015-02-27 Marek Polacek + + PR c/65228 + * gcc.dg/pr65228.c: New test. + 2015-02-27 Richard Biener PR lto/65193 diff --git a/gcc/testsuite/gcc.dg/pr65228.c b/gcc/testsuite/gcc.dg/pr65228.c new file mode 100644 index 000000000000..fd8323876c2a --- /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" } */ +}