[Bug fortran/56007] Remarkably bad error message with DO array=1,2
anlauf at gmx dot de
gcc-bugzilla@gcc.gnu.org
Fri Feb 5 22:38:00 GMT 2016
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)
{
More information about the Gcc-bugs
mailing list