https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56007

--- Comment #5 from Harald Anlauf <anlauf at gmx dot de> ---
The patch of comment #4 appears to be easily extendible to reject
arrays as loop variables (I hope I got this right):

Index: gcc/fortran/match.c
===================================================================
--- gcc/fortran/match.c (revision 232904)
+++ gcc/fortran/match.c (working copy)
@@ -877,6 +877,18 @@
   if (m != MATCH_YES)
     return MATCH_NO;

+  if (var->ts.type == BT_CHARACTER)
+    {
+      gfc_error ("Loop variable at %C cannot be of type CHARACTER");
+      goto cleanup;
+    }
+
+  if (var->symtree->n.sym->attr.dimension)
+    {
+      gfc_error ("Loop variable at %C cannot be an array");
+      goto cleanup;
+    }
+
   /* F2008, C617 & C565.  */
   if (var->symtree->n.sym->attr.codimension)
     {

Reply via email to