ASSIGNED GOTO was deleted in Fortran 95, but FTN95 still supports this. Here is a test program that various versions of FTN95 (and even FTN77) fail to compile.
program tasg
implicit none
integer i,ka
i=3
print *,ka(i)
end
function ka(i)
implicit none
integer i, ka
!
ka = 0
if(i.eq.2)then
assign 10 to ka
else
assign 20 to ka
endif
goto ka
10 ka = i*i
return
20 ka = i+i
return
end
The error message given by FTN95 8.10:
0014) assign 10 to ka
*** Only INTEGER(KIND=3) variables may be ASSIGNed to
This is surprising since ka is a default integer and, therefore, of kind = 3.
The correct output produced by running the program is '6'.
It will be perfectly fine to give this bug low priority or to mark ASSIGNed GOTO and Format labels as 'deleted' in FTN95. On the other hand, there are still codes in use (such as older versions of the BLAS ?NRM2 function) which contain the Assigned GOTO.
The bug is not encountered if the selector variable does not have the same name as the function.