Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!cs.utexas.edu!uunet!ncrlnk!ncr-sd!rb-dc1!shapiro From: shapiro@rb-dc1.UUCP (Mike Shapiro) Newsgroups: comp.lang.fortran Subject: Re: FORTRAN porting question Message-ID: <440@rb-dc1.UUCP> Date: 5 Apr 89 17:36:43 GMT References: <1868@quanta.eng.ohio-state.edu> <330@uncw.UUCP> Reply-To: shapiro@rb-dc1.SanDiego.gould.UUCP (Michael Shapiro) Distribution: usa Organization: Gould/GSD, San Diego (soon to be Encore) Lines: 46 In article <330@uncw.UUCP> session@uncw.UUCP (Zack Sessions) writes: >In article <1868@quanta.eng.ohio-state.edu> kaul@icarus.eng.ohio-state.edu (Rich Kaul) writes: >> >>... The code I have to port has lots of loops like: >> IF (I.EQ.J) GOTO 1000 >> ... >> DO 1000 K=1,77 >> ... >> 1000 CONTINUE >> >>My question is, how should this behave? ... > >I would think that if the code took the goto 1000, that the loop would not >be executed, and control would simply pass to the next statement after the >continue. I agree, it is not very clean coding, and would personally have done >it differently. The statement number referenced in the do statement does not >have to be a continue statement, it can be any executable statement. ... Again in this discussion thread, I think it's important that we remember the rules of the Fortran game (no matter what we think of them): 11.10.8 _Transfer into the Range of a DO-loop_. Transfer of control into the range of a DO-loop from outside the range is not permitted. The above quote is from page 11-9 (lines 15-17) of ANSI X3.9-1978 FORTRAN 77. The range of a DO-loop consists of all the executable statements that appear following the DO statement that specifies the DO-loop, up to and including the terminal statement of the DO-loop. (page 11-6, lines 26-29). Since the code violates the rules, it is not a valid FORTRAN 77 program. The interpretation noted is probably correct, but you will need to verify this by finding out what compiler the code was originally written for and then finding out how that FORTRAN compiler handled this FORTRAN-like non-FORTRAN code. -- Michael Shapiro, Gould/General Systems Division (soon to be Encore) 15378 Avenue of Science, San Diego, CA 92128 (619)485-0910 UUCP: ...sdcsvax!ncr-sd!rb-dc1!shapiro