re PR c/65228 (ICE: expected tree that contains ‘decl minimal’ structure, have ‘error...
authorMarek Polacek <polacek@redhat.com>
Fri, 27 Feb 2015 12:18:57 +0000 (12:18 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Fri, 27 Feb 2015 12:18:57 +0000 (12:18 +0000)
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
gcc/c/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr65228.c [new file with mode: 0644]

index 0bb5dc70600b851f029d17f0fa29e5d39f28ee32..7152fc0d6c1fb68d04c99c5a272c314748b78703 100644 (file)
@@ -1,3 +1,8 @@
+2015-02-27  Marek Polacek  <polacek@redhat.com>
+
+       PR c/65228
+       * c-decl.c (start_decl): Return NULL_TREE if decl is an error node.
+
 2015-02-14  Marek Polacek  <polacek@redhat.com>
 
        PR c/64768
index 8eeee9c53de29646bb0e61f0d5fb993d2e82959a..749785801ee3aad5f092a8545c9d04bd584ef6fa 100644 (file)
@@ -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));
index 5ca86b107f89e8d8a651690437cb763785e14e20..93c5b0dc693e319d3d08db0091d3dc6070c1837a 100644 (file)
@@ -1,3 +1,8 @@
+2015-02-27  Marek Polacek  <polacek@redhat.com>
+
+       PR c/65228
+       * gcc.dg/pr65228.c: New test.
+
 2015-02-27  Kai Tietz  <ktietz@redhat.com>
 
        PR c/35330
diff --git a/gcc/testsuite/gcc.dg/pr65228.c b/gcc/testsuite/gcc.dg/pr65228.c
new file mode 100644 (file)
index 0000000..fd83238
--- /dev/null
@@ -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" } */
+}