Path: utzoo!attcan!uunet!ncrlnk!ncrcae!ece-csc!ncsuvx!lll-winken!ames!mailrus!cornell!uw-beaver!uw-june!uw-entropy!mica!charlie From: charlie@mica.stat.washington.edu (Charlie Geyer) Newsgroups: comp.lang.fortran Subject: Re: DO loops, anyone? Message-ID: <1311@uw-entropy.ms.washington.edu> Date: 12 Mar 89 01:49:13 GMT References: <458@orange19.qtp.ufl.edu> Sender: news@uw-entropy.ms.washington.edu Reply-To: charlie@mica.stat.washington.edu (Charlie Geyer) Organization: UW Statistics, Seattle Lines: 26 Summary: Expires: Sender: Followup-To: In article <458@orange19.qtp.ufl.edu> bernhold@qtp.ufl.edu (David E. Bernholdt) writes: > PROGRAM LOOP > IGO = 1 > DO 501 I = 1, 10 > WRITE (6,*) 'OUTER LOOP, I =',I > IF (IGO .NE. 0) GOTO 501 > DO 501 J = 1, 5 > WRITE (6,*) 'INNER LOOP, J=',J > 501 CONTINUE > STOP > END > > 1) Is the code standard-conforming? I think it is, but perhaps I am > mistaken. No. Statement 501 is in the range of the inner DO loop. So the GOTO branches into the range of an inactive loop. This is not allowed. There was a very long discussion about this about a month ago. Some compilers are friendlier about this than others. Two compilers here execute the code the way you expect. But there is no "correct" way to execute this code.