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

program exception - stack overflow

rafadix08
Beginner
3,015 Views

I received the following message after executing a program:

forrtl: severe(170): Program exception - stack overflow

What do I have to do?

The curious thing is that when I compile the program using just

ifort program.f90

and then execute it, it works fine

however, when I compile using

ifort %FFLAGS% program.f90 %LINK_FNL_STATIC%

and then execute, I get the error message I reproduced above.

PS: I compiled the program using ifort %FFLAGS% program.f90 %LINK_FNL_STATIC% because I will eventually need to call IMSL subroutines.

Thank you,

Rafael

0 Kudos
1 Solution
Steven_L_Intel1
Employee
3,015 Views

One of the switches in %FFLAGS% is /Qopenmp. This has the side-effect of making all local arrays stack-based instead of static. If you have large local arrays, then you might exceed the 1MB stack one gets by default.

The simple solution is to raise the stack size. Use the /F option to specify a larger stack - the F is followed by a deciimal number for the stack size in bytes. Start with /F10000000 and see if that works - if not, double the number. Repeat as needed. An alternative is to use the option /heap-arrays.

View solution in original post

0 Kudos
3 Replies
Steven_L_Intel1
Employee
3,016 Views

One of the switches in %FFLAGS% is /Qopenmp. This has the side-effect of making all local arrays stack-based instead of static. If you have large local arrays, then you might exceed the 1MB stack one gets by default.

The simple solution is to raise the stack size. Use the /F option to specify a larger stack - the F is followed by a deciimal number for the stack size in bytes. Start with /F10000000 and see if that works - if not, double the number. Repeat as needed. An alternative is to use the option /heap-arrays.

0 Kudos
rafadix08
Beginner
3,015 Views
Steve, that worked. Thanks so much!

0 Kudos
lklawrie
Beginner
3,015 Views


My recent stack overflow problem -- see other thread was due to an uninitialized variable. But only release compile outside the IDE showed it. Nothing including debug with all turned on did.

Linda

0 Kudos
Reply