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

Access Violation

Escarela-Perez__Rafa
283 Views
Hi everybody,

I have the following problem. I had my FORTRAN main program and modules working properly. Everything was working OK until I upgraded from VISTA to WINDOWS 7. Suddenly the executable was not working anymore due to an access violation. I was surprised because I was compiling and linking with the exact same directions and the same FORTRAN code. I wanted to see what was going on, so I began to debug my program but there was nothing wrong, the executable was not stopping The program was again running smoothly but the execution speed was slow because I did not use any optimizations (I am including at end of this message the compiler and linker directions for the release and debug versions). Then I looked back for the precise line where the error was generating in the release version, which I found it using the nasty "pause" command. By doing this I realized that by putting any command between the line (that produces the error) and the next line, the error is gone. Then I wanted to see the error was happening also in Linux (also using Intel's Fortran Compiler). In this case a segmentation fault was produced at the same line. However by putting a command between this line and the next one did not solved the segmentation fault. The line generating the access violation and the segmentation fault is inside a Do cycle:

DO I=1, Num_Elm
Crc % Elements(I) % Type = Crc_Udf
Crc % Elements(I) % Num_Nod = 0
Crc % Elements(I) % Nodes = 0
Crc % Elements(I) % Add_Eq = 0
Crc % Elements(I) % Num_Val = 0
Crc % Elements(I) % Region_Label = 0
Crc % Elements(I) % Region_Label(3) = 1
Crc % Elements(I) % Values = 0.0_Pre
Crc % Elements(I) % Current = 0.0_Pre
Crc % Elements(I) % Solid_Current = 0.0_Pre
END DO

The problem is with line: Crc % Elements(I) % Values = 0.0_Pre. I was trying to see if something was wrong with the programming but I couldn't find anything. Then I delete this line and the problem was gone. However this was not a clean solution. So, I decided to delete the line from the do cycle and add the following code:

DO I = 1, Num_Elm
Crc % Elements(I) % Values = 0.0_Pre
ENDDO

The problem is gone at the price of having an additional do cycle. I don't understand what is happening. It should work as initially programmed. I am using Intel Visual Fortran 11.1.051 [Intel 64]

The linker and compiler options are (the debug directives produce a working executable):

Release:

/nologo /O3 /Qparallel /I"D:\Visual Studio 2005\Projects\SML\SML\x64\Release64" /I"D:\Visual Studio 2005\Projects\FLD_LIB\FLD_LIB\x64\Release64" /names:uppercase /module:"x64\Release64\" /object:"x64\Release64\" /check:bounds /libs:qwin /Qmkl:parallel /c

/OUT:"x64\Release64\Ind_Machine.exe" /NOLOGO /LIBPATH:"D:\Visual Studio 2005\Projects\SML\SML\x64\Release64" /LIBPATH:"D:\Visual Studio 2005\Projects\FLD_LIB\FLD_LIB\x64\Release64" /MANIFEST:NO /SUBSYSTEM:WINDOWS /STACK:6000000 /IMPLIB:"D:\Visual Studio 2005\Projects\Ind_Machine\Ind_Machine\x64\Release64\Ind_Machine.lib" mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libiomp5mt.lib sml.lib fld_lib.lib AvFRTd.lib ole32.lib oleaut32.lib

Debug

/nologo /debug:full /Od /I"D:\Visual Studio 2005\Projects\SML\SML\x64\Release64" /I"D:\Visual Studio 2005\Projects\FLD_LIB\FLD_LIB\x64\Debug64" /gen-interfaces /warn:interfaces /names:uppercase /module:"x64\Debug64\" /object:"x64\Debug64\" /traceback /check:bounds /libs:qwin /dbglibs /c


/OUT:"x64\Debug64\Ind_Machine.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"D:\Visual Studio 2005\Projects\SML\SML\x64\Release64" /LIBPATH:"D:\Visual Studio 2005\Projects\FLD_LIB\FLD_LIB\x64\Debug64" /MANIFEST:NO /DEBUG /PDB:"D:\Visual Studio 2005\Projects\Ind_Machine\Ind_Machine\x64\Debug64\Ind_Machine.pdb" /SUBSYSTEM:WINDOWS /STACK:6000000 /IMPLIB:"D:\Visual Studio 2005\Projects\Ind_Machine\Ind_Machine\x64\Debug64\Ind_Machine.lib" mkl_solver_lp64.lib mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libguide40.lib sml.lib FLD_LIB.lib AvFRTd.lib ole32.lib oleaut32.lib
0 Kudos
0 Replies
Reply