`No Source available` when debugging Intel Fortran

2019-09-17 09:19发布

I am debugging the following Fortran code on Microsoft Visual Studio 2012+Intel Visual Fortran:

program customarray

implicit none
real, allocatable, dimension(:):: vector
integer :: nelements, i
real :: sum

print *, 'enter how many values you have'
read *, nelements
allocate(vector(nelements))
print *, 'enter the values'
sum = 0.0

do i=1,nelements
    read *, vector(i)
    sum = sum+vector(i)
end do

end program customarray

As I step through the code using the debugger "step into" tool. Everything runs as expected. However as soon as I reach the very last line

end program customarray

I get a the following dialog box:

enter image description here

I don't understand why I am getting this error. I am frustrated because it runs smoothly when I "Run without debugging" and does not display the same error.

1条回答
孤傲高冷的网名
2楼-- · 2019-09-17 10:06

After the end program with Step Into you are entering the code generated by the compiler to finish the program run and return to Windows.

Step Into will enter any function executed by the program, even internal libraries (might be set-up slightly differently for Fortran). See "Step Over" and "Step Into" in Visual Studio

With Step Over or Step Out you should be able to skip this finishing internal code, but with Step Into you are asking the debugger to take you there.

And, of course, no source is available in that region, because that code executed there is not your user code. It may or may not be compiled C code or even parts of machine code directly inserted there by the compiler.

Similar behaviour can happen at the start of the program. You can also enter the procedures executed by the program when preparing the environment to be able to execute your code. If you just want to debug your code, start debugging at a line corresponding to your executable statement.

查看更多
登录 后发表回答