Index: c-decl.c
===================================================================
--- c-decl.c	(revision 184501)
+++ c-decl.c	(working copy)
@@ -7702,7 +7702,8 @@ start_function (struct c_declspecs *declspecs, str
 
   /* If the declarator is not suitable for a function definition,
      cause a syntax error.  */
-  if (decl1 == 0)
+  if (decl1 == 0
+      || TREE_CODE (decl1) != FUNCTION_DECL)
     return 0;
 
   loc = DECL_SOURCE_LOCATION (decl1);
Index: testsuite/gcc.dg/noncompile/pr52290.c
===================================================================
--- testsuite/gcc.dg/noncompile/pr52290.c	(revision 0)
+++ testsuite/gcc.dg/noncompile/pr52290.c	(revision 0)
@@ -0,0 +1,3 @@
+/* { dg-error "undeclared here" "" { target *-*-* } 3 } */
+/* { dg-error "expected" "" { target *-*-* } 3 } */
+int f()[j]
