Unexpected access violation

Unexpected access violation

I am using the latest: Fortran Compiler XE

The program I am working on has started unexpectedly crashing when compiled in optimized release mode.  However, when compiled in debug mode, there are no errors or warnings.  I have spent a day debugging, and I was able to isolate the portion of the code where the problem occurs.  This code is very unstable, and doing a trivial change can make the problem go away.

Attached is the source code, project, and output BuildLog files.  When compiled in release mode, the program crashes with:
forrtl: severe (157): Program Exception - access violation



Downloadapplication/zip fortran_problem.zip6.35 KB
7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I'm looking at this now. Seems that the optimizer has moved some code that references an omitted argument outside the if(present) test for that argument. Not nice.

Retired 12/31/2016

Escalated as issue DPD200359189. /Qopenmp is required to trigger the error. I will let you know here of any progress on the bug.

Retired 12/31/2016

Thanks for looking at this.  Initially, I was concerned that there was a bug in my fortran code.  Until the compiler is fixed, do you know of a safe way of getting around this problem?  I don't want to disable /Qopenmp since there is parallelization in some of the subroutines, and I am using pardiso from MKL.  While debugging, I noticed that if in fwd_model.f90, I declare the 'is' variable with a SAVE attribute, it doesn't crash.

integer,save:: is

Do you think this would be safe for now, or would it move the problem somewhere else?



I found that all sorts of small modifications made the error go away. A simple one would be to reduce the optimization level on fwd_model.f90 without changing the code. I would be hesitant about adding SAVE declarations on code that is executed in parallel regions.

Retired 12/31/2016

I looked at the attachment in Quote #1 and found:

beta_range.f90    call fwd_model( )

fwd_model.f90  subroutine fwd_model(dpred)

Although routine fwd_model is contained, isn't there an argument mismatch ?
I would have expected this to be wrong in Fortran 95.


John, please look at the code again. In subroutine FWD_MODEL, the argument DPRED is declared OPTIONAL.

Leave a Comment

Please sign in to add a comment. Not a member? Join today