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

resolving severe (170) stack overflow issue

Brian_Murphy
New Contributor II
709 Views

In this related thread it is mentioned that stack overflows should be dealt with using /heap-arrays (Fortran > Optimization > Heap Arrays > 0).  (that means specify 0, not a number >0).

Quite a few years ago I dealt with such a problem with the Linker/System/Stack Reserve size option, i.e. /STACK:50000000, probably at Dr. Fortran's suggestion, but maybe not, it was so long ago.

Is Heap Arrays now the recommended way?  Are there any gotcha's to be aware of?  This is with regards to a console EXE program running in Windows.

0 Kudos
5 Replies
JohnNichols
Valued Contributor III
708 Views

Remind me not to stand to close to you - you seem to attract errors a lot 

 

0 Kudos
Brian_Murphy
New Contributor II
709 Views

I understand your thinking, John.  Many of my problems indeed are self-inflicted.

0 Kudos
Steve_Lionel
Honored Contributor III
709 Views

My first recommendation is to enable heap-arrays.

If you do choose /LINK /STACK, don't start with a high value. Start at 100000000 and increase in units of the same. Too high a value will prevent the program from running at all.

0 Kudos
Brian_Murphy
New Contributor II
709 Views

I'll give heap-arrays a shot.  Given that in visual studio this option is on the Fortran/Optimizations tab, is this option affected by other optimization settings?

For a long time now I have been using /stack with 50 million without any trouble. I was revisiting this because overflow happened today when running a Release build for which I forgot to set it.  It also requires running a calculation case with a relatively large input model since small models do not trigger it.

0 Kudos
Steve_Lionel
Honored Contributor III
709 Views

It is not affected by anything else.

0 Kudos
Reply