From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26467 invoked by alias); 2 Jul 2009 12:36:57 -0000 Received: (qmail 26423 invoked by uid 48); 2 Jul 2009 12:36:46 -0000 Date: Thu, 02 Jul 2009 12:36:00 -0000 Message-ID: <20090702123646.26422.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/31593] Invariant DO loop variables and subroutines In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus at gcc dot gnu dot org" 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: 2009-07/txt/msg00140.txt.bz2 ------- Comment #5 from burnus at gcc dot gnu dot org 2009-07-02 12:36 ------- > > call output (p1, p2, p3, p4) > > That still clobbers p1, p2, p3, and p4 as they are passed by reference so > > is it really undefined code if output changes the values for the do loop? > Yes. Conformance can now be tested at runtime via -fcheck=do. If one wants to change the loop variable, one should use "i=0; do; i = i + 1; if(i >= 10) exit; end do" instead. >>From the F2003 standard, which also applies to loops of the form (2*i, i=1,N) "8.1.6.4.2 The execution cycle": "Except for the incrementation of the DO variable that occurs in step (3), the DO variable shall neither be redefined nor become undefined while the DO construct is active." -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31593