Hi all,
'm not terribly experienced at fortran-coding (3~4 weeks under my belt for fortran; i've done more matlab-scripting before this) but I have the feeling I encountered an error that shouldn't be there (i.e. rather a source-code error or similair)
at a specific integer number, i get an 112 error (which said I did not initialize the variable), while I did initialize that specific number. The following code contains this problem (very simplified). I tried updating silverfrost but that didn't help ('PLATO version 4.7.0'). I'm on a windows 8.1 machine (64-bits) if anyone wants to know
program why_doesnt_it_work
implicit none
integer::i
i=-2139062143
print*,i
i=-2139062145
print*,i
i=-2139062144
print*,i
!the previous two integers got printed, but at this point, I initialize the variable 'i' with the new number, but when called upon in line 10 it says: !'error112,reference to undefined variable, array element of function result (/UNDEF)' - ' main - in file mfd.f95 at line 10 [+0151]'
end program why_doesnt_it_work
I encountered the problem while I did a loop over all integers [do i=-huge(i),huge(i)] to check if a function worked properly for all integers. In this do-loop, I entered the integers one-by-one into a function, and the error occured only in the function (and not in the main program that contained the do-loop). Only for a specific integer, value -2139062144 did the problem occur (as shown in code above; the other two integers work just fine)*
However, the problem does seem a bit hit-and-miss, as in different codes that error did not always appear (although the code shown above consistently hits that error on my computer)
I hope you could give me some guidance/assistance/insight with respect to that weird error
RagD
*note, since the do-loop couldn't get past -2139062144, I did not check if this problem also occurred at higher values