Under certain circumstances, which I cannot quite describe, warning messages issued by the compiler for declared but unused variables, variables given a value but not used later, and variables used before being initialised -- all very useful warnings -- unfortunately contain only the line number of the last line of variable declarations. In most instances, the warning messages contain the line number where a variable is assigned a value or is referenced, which is more useful than the line number of the declarations.
Here is file unusa.f:
subroutine coeff (jj,numnp,nmat,nsd,vn,thn,chpar,matnum,tdep)
implicit none
integer jj,numnp,nmat,nsd,matnum(numnp)
real vn(numnp), thn(numnp),chpar(nsd*16+3,nmat), tdep(nsd*16+3)
integer jjj, jj1, i, m
real v, vj, thj, tt, ro, dw, dg, xks, xnu, xksp, xnup,
+ xkso, xnuo, xksn, xnun, cc
jjj = (jj - 1)*16
if (jj > 1) jj1 = jjj - 16
do i = numnp, 1, -1
m = matnum(i)
v = vn(i)
if (i /= numnp) then
vj = vn(i+1)
thj = thn(i+1)
endif
ro = chpar(1, m)*exp(tdep(1)*tt)
dw = chpar(4, m)*exp(tdep(4)*tt)
dg = chpar(5, m)*exp(tdep(5)*tt)
xks = chpar(jjj+6, m)*exp(tdep(jjj+6)*tt)
xnu = chpar(jjj+7, m)*exp(tdep(jjj+7)*tt)
if (jj > 1) then
xksp = chpar(jj1+6, m)*exp(tdep(jj1+6)*tt)
xnup = chpar(jj1+7, m)*exp(tdep(jj1+7)*tt)
endif
xkso = chpar(jjj+6, m)*exp(tdep(jjj+6)*tt)
xnuo = chpar(jjj+7, m)*exp(tdep(jjj+7)*tt)
end do
return
end
The 8.70 compiler reports:
[FTN95/Win32 Ver. 8.70.0 Copyright (c) Silverfrost Ltd 1993-2020]
WARNING S:\lang\ftn95\unus\unusa.F 7: Variable V has been given a value but never used
WARNING S:\lang\ftn95\unus\unusa.F 7: Variable VJ has been given a value but never used
WARNING S:\lang\ftn95\unus\unusa.F 7: Variable THJ has been given a value but never used
WARNING S:\lang\ftn95\unus\unusa.F 7: Variable TT has been used without being given an initial value
WARNING S:\lang\ftn95\unus\unusa.F 7: Variable RO has been given a value but never used
WARNING S:\lang\ftn95\unus\unusa.F 7: Variable DW has been given a value but never used
WARNING S:\lang\ftn95\unus\unusa.F 7: Variable DG has been given a value but never used
WARNING S:\lang\ftn95\unus\unusa.F 7: Variable XKS has been given a value but never used
WARNING S:\lang\ftn95\unus\unusa.F 7: Variable XNU has been given a value but never used
WARNING S:\lang\ftn95\unus\unusa.F 7: Variable XKSP has been given a value but never used
WARNING S:\lang\ftn95\unus\unusa.F 7: Variable XNUP has been given a value but never used
WARNING S:\lang\ftn95\unus\unusa.F 7: Variable XKSO has been given a value but never used
WARNING S:\lang\ftn95\unus\unusa.F 7: Variable XNUO has been given a value but never used
WARNING S:\lang\ftn95\unus\unusa.F 7: Variable XKSN has been declared but not used
WARNING S:\lang\ftn95\unus\unusa.F 7: Variable XNUN has been declared but not used
WARNING S:\lang\ftn95\unus\unusa.F 7: Variable CC has been declared but not used
NO ERRORS, 16 WARNINGS [<COEFF> FTN95 v8.70.0]
My complaint is that all the warnings mention line 7, on which the declarations end.