Stack overflow query

Stack overflow query

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?

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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.

Retired 12/31/2016

Which project hould have Heap Arrays set? The program that loads and accesses the DLL, or the DLL itself?

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.

Retired 12/31/2016

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.

Right - CVF doesn't have the Heap Arrays option.

Retired 12/31/2016

Leave a Comment

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