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

Stack compiler/linker options

lklawrie
Beginner
1,158 Views

Another person looking at our code experienced a stack overflow with one of the input files.  And then put on Stack options for compile (/F) and Link (STACK:)

I cannot find these in the current compiler (Fortran 2013/ X13) documentation.  Are they still viable?

0 Kudos
6 Replies
Steven_L_Intel1
Employee
1,158 Views

Yes, and they're still documented. /STACK is a linker option, so if you want to use it from the command line, precede it with /LINK and put it at the end of the line, for example:

ifort foo.f90 /link /stack:100000000

/F is documented and is a compiler option (though it turns into a linker option) - it has to be used on the ifort command that links the program.

May I suggest you try /heap-arrays first?

0 Kudos
lklawrie
Beginner
1,158 Views

I did try heap arrays on the module that was indicated as causing the problem but it didn't seem to help.  Nor could I exactly duplicate the problem.  Would deep recursion also cause a stack overflow?

I couldn't locate /F in the recent compiler options documentation.

0 Kudos
TimP
Honored Contributor III
1,158 Views

Yes, recursion consumes stack.

0 Kudos
Steven_L_Intel1
Employee
1,158 Views

I just opened the documentation from Visual Studio and typed /F into the index tab.

0 Kudos
lklawrie
Beginner
1,158 Views

got it -- it's under the "Linker or Linker Options" topic, by the way.

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,158 Views

>>Would deep recursion also cause a stack overflow?

Is a significant portion of locally declared data having the characteristic of NOT being required to be preserved through a recursion?

If so, then these could be SAVE, or thread local SAVE, or other means such that there is but one copy.

Jim Dempsey

0 Kudos
Reply