Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/17/84; site hao.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!teddy!panda!talcott!harvard!seismo!hao!woods From: woods@hao.UUCP (Greg Woods) Newsgroups: net.lang.f77 Subject: Re: bug using loop variable as start value Message-ID: <1342@hao.UUCP> Date: Thu, 17-Jan-85 13:08:31 EST Article-I.D.: hao.1342 Posted: Thu Jan 17 13:08:31 1985 Date-Received: Sat, 19-Jan-85 01:23:34 EST References: <787@ttds.UUCP> Organization: High Altitude Obs./NCAR, Boulder CO Lines: 25 > C The example below reproduces a bug in f77. > C > C The error seems to be caused by using L both as loop variable and as the > C start value of the loop. It is clear from the output that the first loop > C is never executed as L obtains its large value, 2147479256, before the first > C test. The problem should thus have nothing to do with the question > C whether the loop variable is undefined or not after exiting the loop. > C > DIMENSION X(10) > L=1 > DO 100 L=L,10 > X(L)=L > 100 CONTINUE This is not a bug. You are violating the standard. The standard does not allow this type of loop initialization. The order of evaluation in the DO 100 statement is not guaranteed to be what you think it will be. --Greg -- {ucbvax!hplabs | allegra!nbires | decvax!stcvax | harpo!seismo | ihnp4!stcvax} !hao!woods "...sometimes the light's all shining on me; other times I can barely see..."