The full error i'm getting is Unhandled exception at 0x0162EF4C in MAIN.exe: 0xC0000005: Access violation reading location 0x00000000
I think this is just a symptom of an underlying problem. I've been struggling with these types of issues off and on for many years and have never figured out for sure why they happen.
I get this error only with a release build with the following settings:
/nologo /debug:full /O3 /Qipo /fpp /I"C:\Program Files (x86)\Intel\Composer XE\mkl\include\ia32" /I"C:\Program Files (x86)\MATLAB\R2010b\extern\include" /warn:all /debug-parameters:all /fp:fast=2 /Qfp-stack-check /module:"Release\INTERMEDIATE\\" /object:"Release\INTERMEDIATE\\" /Fd"Release\INTERMEDIATE\vc110.pdb" /check:uninit /libs:static /threads /Qmkl:sequential /c
When i run the debug build the program seems to run correctly.
If i throw a simple write statement:
write(*,*) 'hello'
before the line that this error occurred on, the program will run without throwing the error. If i change the build settings to /O2 I can get it to run but produce incorrect results.
I ran the program in inspector, and i get a critical item "Unhandled application exception" and a "Invalid memory access" on the same line, but i don't see anything obvious that points to a cause for this error.
In my experience with these issues, i've seen lots of strange behavior for example a simple assignment statement where after execution the left hand side doesn't equal the right hand side, but then if the same statement is repeated the value will "stick".
I have no c functions being called (i had thought these were the problem previously).
Has anyone else run into this before?
rob