This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/50536] an input item shall not appear as the do-variable of any io-implied-do
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 20 Jul 2013 20:21:50 +0000
- Subject: [Bug fortran/50536] an input item shall not appear as the do-variable of any io-implied-do
- Auto-submitted: auto-generated
- References: <bug-50536-4 at http dot gcc dot gnu dot org/bugzilla/>
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 ();