From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27039 invoked by alias); 17 Oct 2012 19:16:22 -0000 Received: (qmail 26963 invoked by uid 48); 17 Oct 2012 19:16:06 -0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/54958] New: Wrongly rejects ac-implied-DO variables which also occur with INTENT(IN) Date: Wed, 17 Oct 2012 19:16:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2012-10/txt/msg01582.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54958 Bug #: 54958 Summary: Wrongly rejects ac-implied-DO variables which also occur with INTENT(IN) Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: burnus@gcc.gnu.org gfortran rejects all four uses of "i" in the following program with Error: Dummy argument 'i' with INTENT(IN) in variable definition context (iterator variable) at (1) However, it should only reject the use as variable in io-implied-do and in the do-stmt and not the (ac-,data-)implied-do variable. Cf. IR 000076 at ftp://ftp.nag.co.uk/sc22wg5/n1351-n1400/N1393.txt g95, pathf95 and NAG properly handle this case, gfortran 4.1 to 4.8 doesn't. subroutine test(i) integer, intent(in) :: i integer :: A(5) ! Valid: data-implied-do [WRONGLY rejected by gfortran] DATA (A(i), i=1,5)/5*42/ ! Valid: ac-implied-do [WRONGLY rejected by gfortran] print *, [(i, i=1,5 )] ! Invalid: io-implied-do [OK: rejected by gfortran] print *, (i, i=1,5 ) ! Invalid: do-variable in a do-stmt [OK: rejected by gfortran] do i = 1, 5 end do end >>From the standard (F2008): "C539 (R523) A nonpointer object with the INTENT (IN) attribute shall not appear in a variable definition context (16.6.7)." and in "16.6.7 Variable definition context": "(4) a do-variable in a do-stmt or io-implied-do;" The reason that a data-implied-do and ac-implied-do is allowed is given at "16.4 Statement and construct entities": "The name of a data-i-do-variable in a DATA statement or an ac-do-variable in an array constructor has a scope of its data-implied-do or ac-implied-do. [...] The appearance of a name as a data-i-do-variable of an implied DO in a DATA statement or an ac-do-variable in an array constructor is not an implicit declaration of a variable whose scope is the scoping unit that contains the statement."