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

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

Harry_G_
Beginner
1,527 Views

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.

 

0 Kudos
5 Replies
Andrew_Smith
Valued Contributor I
1,527 Views

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

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

0 Kudos
Les_Neilson
Valued Contributor II
1,527 Views

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.

Les

0 Kudos
Harry_G_
Beginner
1,527 Views

@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.

0 Kudos
Harry_G_
Beginner
1,527 Views

@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.

0 Kudos
Les_Neilson
Valued Contributor II
1,527 Views

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.

Les

0 Kudos
Reply