From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16195 invoked by alias); 20 Jul 2013 20:23:54 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 13991 invoked by uid 48); 20 Jul 2013 20:21:51 -0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/50536] an input item shall not appear as the do-variable of any io-implied-do Date: Sat, 20 Jul 2013 20:23:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.7.0 X-Bugzilla-Keywords: accepts-invalid, diagnostic, patch X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-07/txt/msg00920.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50536 Tobias Burnus changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |accepts-invalid, | |diagnostic, patch CC| |burnus at gcc dot gnu.org --- Comment #5 from Tobias Burnus --- 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 ();