Some details are given below about how to probe this error, which may help in debugging Wahorger's program, and other large programs that cannot be compiled with /check or /undef for some good reason, and memory corruption is suspected.
In an attempt to see how the source code could be modified to avoid subscript errors from clobbering constants, I changed the test program as follows:
! http://forums.silverfrost.com/viewtopic.php?p=32570#32570
program wahbug
implicit none
integer, parameter :: SLEN=16 ! gets clobbered by writing to fms(3)
character(len=SLEN) :: fms(2)
data fms/'feet/inch','meters/2.54 cm'/
integer:: i_logmtr, ls
integer*8 :: l8
!
i_logmtr = 2
ls = 3
fms(ls) = ' ' !deliberately exceed upper bound of array
l8 = len_trim(fms(i_logmtr))
print *,l8
end program
Compile with /64 /full_debug and link. Running the program gives an access violation inside LENG8$. Running the program within SDBG64 causes 'access violation reading address FFFFFFFFFFFFFFFF' inside LENG8$. Neither message helps in understanding what caused the access violation.
To understand what happened, restart the program in SDBG64, set a breakpoint on line-13, 'l8 = len_trim(fms(i_logmtr))', and run up to the breakpoint. Press F11. Open the registers window.
Step forward two machine instructions, stopping at 'imul_q R15,...'
Observe that R15 contains the value 1.
Step forward one instruction. But for the bug, we should have seen R15 change to Z'00000000000000010', i.e,. the string length, 16. However, that 'constant' has been clobbered, and we see Z'2020202020202020'. Observing this is a good hint that the string with 16 blanks has been written over the (supposedly constant) parameter SLEN.