http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50536
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |accepts-invalid,
| |diagnostic, patch
CC| |burnus at gcc dot gnu.org
--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Simple - and completely untested - patch. I am not quite sure whether nested
io-implied-dos can appear - if they can, the patch would be insufficient.
However, I cannot come up with any nested io-implied-do for READ (which
requires the items to be variables). Hence, the patch is presumably sufficient.
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -3057,2 +3057,12 @@ match_io_iterator (io_kind k, gfc_code **result)
+ if (k == M_READ)
+ for (new_code = head; new_code; new_code = head->next)
+ if (iter->var->symtree == new_code->expr1->symtree)
+ {
+ gfc_error ("In a READ statement, the input item at %L shall not "
+ "be the do-variable of any io-implied-do");
+ m = MATCH_ERROR;
+ goto cleanup;
+ }
+
new_code = gfc_get_code ();