Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 (MC840302); site ttds.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!mcvax!enea!ttds!sundman From: sundman@ttds.UUCP (Bo Sundman) Newsgroups: net.lang.f77 Subject: bug using loop variable as start value Message-ID: <787@ttds.UUCP> Date: Mon, 14-Jan-85 21:07:18 EST Article-I.D.: ttds.787 Posted: Mon Jan 14 21:07:18 1985 Date-Received: Fri, 18-Jan-85 03:24:26 EST Reply-To: sundman@ttds.UUCP (Bo Sundman) Organization: The Royal Inst. of Techn., Stockholm Lines: 31 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 200 WRITE(*,*)L,X I=1 DO 300 L=I,10 X(L)=L 300 CONTINUE 400 WRITE(*,*)L,X END C Output from the example: C C 2147479256 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. C 11 1.00000 2.00000 3.00000 4.00000 5.00000 6.00000 7.00000 C 8.00000 9.00000 10.0000 -- Bo Sundman (..mcvax!enea!ttds!sundman) Thermo-Calc group, Division of Physical Metallurgy The Royal Institute of Technology Stockholm, Sweden