Help! [code & data included] forrtl: severe <157>: Program Exception - access violation

Help! [code & data included] forrtl: severe <157>: Program Exception - access violation

Hi all,

I have been stuck in this problem for two weeks. (pity...) Now, it's time to seek experts' help on this "severe <157> problem." I attach my code and data. I would really appreciate it if someone, anyone, can help on memory access problem.


Downloadapplication/octet-stream mycode.f903.47 KB
Downloadtext/plain p.txt2.27 MB
Downloadtext/plain s.txt75.85 KB
6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Exception at line 79 caused by not allocating space for smat.

Have you been compiling with debugging information and debug options turned on ?

It is probably unrelated but, since the value of ndist does not change, you could move the allocate statement outside of the do loop and remove the deallocate. There might be a memory fragmentation isuue.

I haven't looked at the code in detail yet.


@Andrew: Thank you for your comment. The additional allocation for "smat" does not produce any further message, but the memory problem still exist.

@Les: Thank you for your comment. I took the allocation lines out for the nsim loop. Now, the original access violation problem disappeared. However, after executing the program, it does not produce any result. It seems that it runs forever and does not finish the job.

@all: I think I solve the problem (at least, the access violation problem). I kept looking at the "smat" thanks to the Andrew's suggestion, and I fixed the subscripting of the "smat."

@Les: But that was possible if I moved the allocate/deallocate statements out of the nsim loop. Being them inside the nsim loop, I have the same "forrtl: severe <157>" message. I don't understand why I cannot repeat the allocate-deallocate process.

It is not a case of "cannot repeat the allocate-deallocate process" It is simply that the size of the arrays does not change so why do it. Also Windows has to manage the memory and if the continuous allocate / deallocate could fragment memory so that an allocate might fail. In which case You have no error check on the allocate (or deallocate) Unallocated arrays would cause exceptions when you try to access them.


Leave a Comment

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