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

fortran, error 157 access violation when using the IMSL library NEQNF

Giacomarra__Federico
902 Views

Dear Fortran Forum,

when I try to use the library NEQNF to solve a generic non-linear system, I get the following error:

forrtl: severe (157): Program Exception - access violation

I really do not know what the problem might be, also because I do not have any issues when I use another library, for example ZREAL.

Visual studio actually builds the code, but when I run it, I get this type of error. I'm using VS 2012 in Debug Win32. 

What could be the source of this problem and how can I solve it? I write here an example of a code to solve a generic non-linear system: 

Can anyone offer any suggestions?

Thanks.

Federico

 

PROGRAM NONLINEARSYSTEM

include 'link_fnl_shared.h'

USE NEQNF_INT
!USE IMSL_LIBRARIES
IMPLICIT NONE
INTEGER(4) N,ITMAX
PARAMETER (N=2)
REAL(8) X(N),X0(N)
REAL(8) ERRREL

EXTERNAL SYST
ERRREL = 1.0E-5


X0(1) = 1.
X0(2) = 1.
ITMAX=10000
CALL NEQNF(SYST, X, ERRREL, N, ITMAX, XGUESS=X0)
    END PROGRAM 
    
SUBROUTINE SYST (X,F,N)
IMPLICIT NONE
INTEGER(4) N
REAL(8) X(N),F(N)
F(1) = X(1) * X(1) - X(2)
F(2) = X(2) + LOG (X(1)) - 2 
RETURN
END SUBROUTINE SYST

 

 

 

0 Kudos
11 Replies
mecej4
Honored Contributor III
902 Views

Your test program runs and gives the final x = [1.31410,  1.72685] after about 8 function evaluations, when built with IFort 2017 Update 4 and IMSL 7.

Please provide details regarding your OS, compiler and IMSL FNL versions.

0 Kudos
Giacomarra__Federico
902 Views

My compiler is Visual Studio 2012, and I run the debug Win32 on windows 7. About IMSL FNL version I use IMSL 7 too.

0 Kudos
mecej4
Honored Contributor III
902 Views

Please compile and run with the /traceback option added, and report the traceback output in your reply.

I again built the program using the old version IFort 11.1.072 and FNL 7.0.1, and the program ran correctly (IA32 or Intel64). Please state which compiler version you use.

 

0 Kudos
Steve_Lionel
Honored Contributor III
902 Views

And just to avoid confusion, Visual Studio is not a compiler.

0 Kudos
Giacomarra__Federico
902 Views

Sorry, I just started working on Visual Studio in Fortran language.

First of all, I would like to thank you for your availability.

Actually my compiler is: Intel (R) Visual Fortran Compiler XE 13.0.1.119 [IA-32]

I attach what I think the traceback output is. Otherwise, please tell me where I can find the traceback output. Again, I thank you for your time.

Federico.2017-11-1_ 11.03.04.png

 

0 Kudos
mecej4
Honored Contributor III
902 Views

The traceback has the correct format, but the PC (program counter) values indicate that you probably used the older IMSL installer imsl_7.0.1.027_setup.exe rather than the current imsl_7.0.1.033_setup.exe. Can you confirm this, assuming that you installed IMSL yourself?

I am afraid that there are few IMSL users who use the same versions of VS, Ifort and IMSL as you, so reproducing the bug can be troublesome. 

If you can find the file BUILDLOG.HTM (this is produced when Visual Studio is used to build your EXE), please post it, there may be some clues in it.

0 Kudos
Giacomarra__Federico
902 Views

I just found out that the actual that the actual IMSL version   I am using is:

IMSL(R) Fortran Numerical Library
                            Version 6.0.0

About the file BUILDLOG, this is the output. (Unfortunately, I cannot attach a file with extension .htm)

Federico.

 

Output
 
Compiling with Intel(R) Visual Fortran Compiler XE 13.0.1.119 [IA-32]...
ifort /nologo /debug:full /Od /I"C:\Program Files (x86)\VNI\imsl\fnl600\ia32\include\dll" /I"C:\dislin\disifc.lib" /I"C:\dislin\disdll.lib user32.lib gdi32.lib" /I"C:\dislin" /I"C:\dislin\win" /I"C:\dislin\ifc" /I"C:\dislin\disifm.lib user32.lib gdi32.lib" /I"C:\dislin\disifl.lib user32.lib gdi32.lib" /Qsave /iface:cvf /module:"Debug/" /object:"Debug/" /Fd"Debug\vc110.pdb" /traceback /check:bounds /libs:static /threads /dbglibs /c /traceback /Qvc11 /Qlocation,link,"C:\Users\MacBookAir\Desktop\VC\\bin" "C:\Users\Federico\Desktop\eser1fortran\3d1planare\eser1.f90"
Linking...
Link /OUT:"Debug/3d planare.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files (x86)\VNI\imsl\fnl600\ia32\lib" /LIBPATH:"C:\dislin" /LIBPATH:"C:\dislin\win" /LIBPATH:"C:\dislin\disifc.lib" /LIBPATH:"C:\dislin\disdll.lib user32.lib gdi32.lib" /LIBPATH:"C:\dislin\ifc" /LIBPATH:"C:\dislin\disifm.lib user32.lib gdi32.lib" /LIBPATH:"C:\dislin\disifl.lib user32.lib gdi32.lib" /MANIFEST /MANIFESTFILE:"C:\Users\Federico\Desktop\eser1fortran\3d1planare\Debug\3d planare.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"Debug/3d planare.pdb" /SUBSYSTEM:CONSOLE kernel32.lib /MACHINE:I386 "Debug/eser1.obj"
ipo: warning #11077: C:\Users\Federico\Desktop\eser1fortran\3d1planare\Debug/eser1.obj: locally defined symbol __imp__MPIPRIV1 imported
ipo: warning #11077: C:\Users\Federico\Desktop\eser1fortran\3d1planare\Debug/eser1.obj: locally defined symbol __imp__MPIPRIV2 imported
ipo: warning #11077: C:\Users\Federico\Desktop\eser1fortran\3d1planare\Debug/eser1.obj: locally defined symbol __imp__MPIPRIVC imported
Link: executing 'link'
eser1.obj : warning LNK4049: il simbolo _MPIPRIV1 definito localmente è stato importato
eser1.obj : warning LNK4049: il simbolo _MPIPRIV2 definito localmente è stato importato
eser1.obj : warning LNK4049: il simbolo _MPIPRIVC definito localmente è stato importato
 
Embedding manifest...
mt.exe /nologo /outputresource:"C:\Users\Federico\Desktop\eser1fortran\3d1planare\Debug\3d planare.exe;#1" /manifest "C:\Users\Federico\Desktop\eser1fortran\3d1planare\Debug\3d planare.exe.intermediate.manifest"
 
3d planare_ - 0 error(s), 6 warning(s)
0 Kudos
andrew_4619
Honored Contributor II
902 Views

/iface:cvf  I think is wrong it should be the default calling convention not "compact visual fortran" convention which was stdcall based

0 Kudos
Giacomarra__Federico
902 Views

Andrew,

How can I use the default calling convention instead of cvf?

Thank you,

Federico.

0 Kudos
mecej4
Honored Contributor III
902 Views

Do not use the /iface: option at all, or specify /iface:default.

0 Kudos
Giacomarra__Federico
902 Views

Thank you all very much! Now, it seems to be working: I just changed that option as suggested.

Federico

0 Kudos
Reply