Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!uflorida!ufqtp!bernhold From: bernhold@qtp.ufl.edu (David E. Bernholdt) Newsgroups: comp.lang.fortran Subject: DO loops, anyone? Message-ID: <458@orange19.qtp.ufl.edu> Date: 11 Mar 89 15:49:54 GMT Reply-To: bernhold@qtp.ufl.edu (David E. Bernholdt) Organization: University of Florida Quantum Theory Project Lines: 49 I run the following code on my Sun 3/50 with VMS compatible f77: 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 And I get the following output: OUTER LOOP, I = 1 INNER LOOP, J= 1 INNER LOOP, J= 2 INNER LOOP, J= 3 INNER LOOP, J= 4 INNER LOOP, J= 5 OUTER LOOP, I = 2 OUTER LOOP, I = 3 OUTER LOOP, I = 4 OUTER LOOP, I = 5 OUTER LOOP, I = 6 OUTER LOOP, I = 7 OUTER LOOP, I = 8 OUTER LOOP, I = 9 OUTER LOOP, I = 10 Notice that the inner DO loop is executed exactly once. My questions are these: 1) Is the code standard-conforming? I think it is, but perhaps I am mistaken. 2) If the code is standard-conforming, is the execution correct? As far as I can tell, the inner DO should never be activated! Please, no flames about the code itself. I did not write it - I just get to port it. -- David Bernholdt bernhold@qtp.ufl.edu Quantum Theory Project bernhold@ufpine.bitnet University of Florida Gainesville, FL 32611 904/392 6365