Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29376 Discussions

access violation in release but debug runs

anishtain4
Beginner
964 Views
My program runs with debug, but when I switch to release it gives me an access violation error!! there is nothing written on the window, so I don't know which subroutine is making the problem?
can you confirm this? I have uploaded the files, let me know what am I doing wrong?
0 Kudos
3 Replies
mecej4
Honored Contributor III
964 Views
There are several circumstances in which the caller(s) of a subroutine/function must have available an explicit interface to the callee. One of them is when some of the subprogram arguments are assumed-size or allocatable, for example the call to INITIAL in the main program.

Compile with the /warn option to make the compiler detect and report the problems.

Compile with the /gen-interfaces /warn:interfaces options to have the compiler automatically generate the interfaces and use them. You will see numerous warnings of

Required interface for passing assumed shape array is missing from original source.

I recommend that you use the interfaces that the compiler produces as a basis and incorporate the interfaces into your source code.
0 Kudos
anishtain4
Beginner
964 Views
If I don't want to manually write the interface I have to pass the dimensions as arguments?
for example like:

subourine test(A,B,im,jm)
integer::im,jm
real::A(im,jm),B
end subroutine

this does not needs explicit interface?
0 Kudos
mecej4
Honored Contributor III
964 Views
An implicit interface is sufficient when the array arguments have "assumed size", as in your example.

However, it is typically the case that an array argument such as A is dimensioned in the caller as A(imax, jmax), where imax > im. In such cases, it is necessary to pass both imax and im as arguments to the subroutine.

Since Fortran uses column-major order for 2-D arrays, jmax need not be passed to the subroutine.
0 Kudos
Reply