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

Stack overflow query

anthonyrichards
New Contributor III
991 Views
I am developing a DLL for which I have a test program that is used to call and debug the DLL code.
I have run through all the main routines OK so far, debugging as I go, but I have come across a set of data that has resulted in a stack overflow. I use allocated arrays, but they are not enormous in size. When the debugger breaks, the cursor points to a specification statement for two of the allocatable arrays.

Is it likely that the stack overflow is related to array allocation and how can I avoid the problem?

0 Kudos
5 Replies
Steven_L_Intel1
Employee
991 Views
I might expect a stack overflow for an automatic array - a local array whose bounds are determined by a dummy argument, COMMON variable or use/host associated variable, but not for an allocatable. Is there perhaps another array being declared on that line?

Try setting the Fortran project property Optimization > Heap Arrays to 0.
0 Kudos
anthonyrichards
New Contributor III
991 Views
Which project hould have Heap Arrays set? The program that loads and accesses the DLL, or the DLL itself?
0 Kudos
Steven_L_Intel1
Employee
991 Views
The project with the Fortran code getting the stack overflow - that would probably be the DLL project. I will note that if you want instead to raise the linker's stack size, that has to be in the executable project, not the DLL.
0 Kudos
anthonyrichards
New Contributor III
991 Views
I am testing this code using CVF. For the executable project properties, I found and changed the Link...Output stack reserve and commit values to large values (Commit< reserve) and the stack overflow has disappeared - possibly only temporarily.

I guess when I go to my IVF version I could try heap:arrays option, which appears not to be available with the DevStudio/CVF combination.

Thanks.
0 Kudos
Steven_L_Intel1
Employee
991 Views
Right - CVF doesn't have the Heap Arrays option.
0 Kudos
Reply