@egio ,
This “very old FORTRAN … code” appears equivalent to:
SUBROUTINE SUB(IRANK, N)
IF (IRANK-N) 17,19,19
17 CONTINUE
PRINT *, "LET US REPEAT 3 TIMES THAT"
DO 19 I = 1, 3
PRINT *, "ARITHMETIC IF IS DELETED FROM THE FORTRAN STANDARD!"
19 CONTINUE
RETURN
END SUBROUTINE
N = 1
IRANK = 0
CALL SUB(IRANK, N)
IRANK = 1
CALL SUB(IRANK, N)
END
that gfortran appears to work with as a “legacy extension” - see the warning below, “Legacy Extension: Label at (1) is not in the same block as the GOTO statement at (2)”:
C:\temp>gfortran p.f -o p.exe
l.f:2:72:
2 | IF (IRANK-N) 17,19,19
| 1
Warning: Fortran 2018 deleted feature: Arithmetic IF statement at (1)
l.f:7:3:
2 | IF (IRANK-N) 17,19,19
| 2
......
7 | 19 CONTINUE
| 1
Warning: Legacy Extension: Label at (1) is not in the same block as the GOTO statement at (2)
l.f:7:3:
2 | IF (IRANK-N) 17,19,19
| 2
......
7 | 19 CONTINUE
| 1
Warning: Legacy Extension: Label at (1) is not in the same block as the GOTO statement at (2)
C:\temp>p.exe
LET US REPEAT 3 TIMES THAT
ARITHMETIC IF IS DELETED FROM THE FORTRAN STANDARD!
ARITHMETIC IF IS DELETED FROM THE FORTRAN STANDARD!
ARITHMETIC IF IS DELETED FROM THE FORTRAN STANDARD!
Now, imagine the original code as follows with the DO construct following statement 17 using a different label for the DO than 19:
SUBROUTINE SUB(IRANK, N)
IF (IRANK-N) 17,19,19
17 CONTINUE
PRINT *, "LET US REPEAT 3 TIMES THAT"
DO 18 I = 1, 3
PRINT *, "ARITHMETIC IF IS DELETED FROM THE FORTRAN STANDARD!"
18 CONTINUE
RETURN
19 CONTINUE
RETURN
END SUBROUTINE
N = 1
IRANK = 0
CALL SUB(IRANK, N)
IRANK = 1
CALL SUB(IRANK, N)
END
Give this a try - chances are gfortran will issue no “legacy extension” warnings and IFORT will issue no errors.