Hello:
I am getting a runtime error, and I was hoping that somebody could help explain to me exactly what is going on. I am running windows 10, Visual Studio 2015, and compiler version 17.0.2.187, in Debug Mode. When I run in Release Mode there is no runtime error (which doesn't surprise me). And if rollback to use the XE 15.0.4.221 compiler, I also don't get an error (even in Debug Mode).
I have stripped down the program to create a simple example that still gives me the runtime error. I have attached the solution file, project file, source code file, and the input file. Since it's a pretty short sample program, I'll paste it here for convenience:
program Test
call TempSub(1)
contains
subroutine TempSub(low)
integer :: low
integer :: intVar
double precision, dimension(low:2) :: arr
open(unit=13,file="test.txt")
read(13,*) intVar,arr(:)
close(13)
end subroutine TempSub
end program Test
The error I get is:
forrtl: severe (157): Program Exception - access violation
And it tells me that it happens on line 15 (the "read") line. If I change line 15 from:
read(13,*) intVar,arr(:)
to:
read(13,*) intVar,arr
then it also runs fine (no runtime error).
Can someone please explain to me what's going on with this short piece of code? I'm not sure if what I'm trying to do is illegal, or if perhaps this is a compiler bug.
Thanks for your help.
Michael