diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index d348e39c27a1f1c6641a5dbcd756ec19746e3230..1b02240114b8a2aed9453ee30f3437fe20957b9b 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -5775,6 +5775,8 @@ get_parm_array_spec (const struct c_parm *parm, tree attrs)
 	       type = TREE_TYPE (type))
 	    {
 	      tree nelts = array_type_nelts (type);
+	      if (error_operand_p (nelts))
+		return attrs;
 	      if (TREE_CODE (nelts) != INTEGER_CST)
 		{
 		  /* Each variable VLA bound is represented by the dollar
diff --git a/gcc/testsuite/gcc.dg/pr97860.c b/gcc/testsuite/gcc.dg/pr97860.c
new file mode 100644
index 0000000000000000000000000000000000000000..04c0f194bde04987410902768455b8a0e8a01698
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97860.c
@@ -0,0 +1,11 @@
+/* PR c/97860 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void
+foo (int n)
+{
+  typedef int T[0];
+  typedef T V[n];
+  void bar (V);
+}
diff --git a/gcc/tree.c b/gcc/tree.c
index 004385548c94bd854de828b5e9135f59ead371ff..531fe96542259967d85ea058a1832e5300f5ab84 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -3483,7 +3483,17 @@ array_type_nelts (const_tree type)
 
   /* TYPE_MAX_VALUE may not be set if the array has unknown length.  */
   if (!max)
-    return error_mark_node;
+    {
+      /* zero sized arrays are represented from C FE as complete types with
+	 NULL TYPE_MAX_VALUE and zero TYPE_SIZE, while C++ FE represents
+	 them as min 0, max -1.  */
+      if (COMPLETE_TYPE_P (type)
+	  && integer_zerop (TYPE_SIZE (type))
+	  && integer_zerop (min))
+	return build_int_cst (TREE_TYPE (min), -1);
+
+      return error_mark_node;
+    }
 
   return (integer_zerop (min)
 	  ? max