I'm attempting to compile Fortran code that was written and compiled in the late eighties on a DEC operating system. I'm not sure what version of Fortran the code is written in.
I'm on macOS version 10.14.6, and using gfortran version 8.2.0.
When I attempt to compile on the command-line with:
gfortran -v -fdec- o test CODE.FOR
I receive the following error:
CODE.FOR:1618:72: CODE.FOR: 1599:72: CODE.FOR:1618.72: Error: Variable 'j' at (1) cannot be redefined inside loop beginning at (2) When I look at the line 1618, I see: J=J-1, which is inside a DO loop.
Is the code so old that this used to compile on an older compiler but now on gfortran it won't allow variable j to be changed in a DO loop?
DO 10 J=1,NMAX WRITE(6,*)' Give STA NAME, COMP(Z, R, or T), and WAVE TYPE (P, SV, * or SH)' WRITE(6,*)' Enter blanks to quit' WRITE(6,*)' Reenter STA NAME, COMP and WAVE TYPE to replace old or *incorrect data' WRITE(6,*)' Separate each entry by a space (STA NAME is 4 chars)' READ(5,2) SN(J),COMP(J),PS(J) 2 FORMAT(A,1X,A,1X,A) IF (SN(J).EQ.' ') GO TO 900 WRITE(6,*)' Give DIST, AZ, and AMP' READ(5,*) R(J),AZ(J),AMP(J) IF (J.GT.1) THEN DO 11 I=1,J-1 IF (SN(J).EQ.SN(I).AND.COMP(J).EQ.COMP(I).AND.PS(J).EQ.PS(I)) * THEN R(I)=R(J) AZ(I)=AZ(J) AMP(I)=AMP(J) J=J-1 GO TO 10 END IF 11 CONTINUE END IF 10 CONTINUE