LF Fortran 95

-STACK reserve[:commit]

Stack Size

Link only. Default: -stack 1000000h

The -STACK option specifies the size of the stack area for a program. The option must be followed by a numeric constant that specifies the number of bytes to be allocated to the stack.

reserve is the maximum size of the stack

commit is the increment used when increasing the stack size during runtime

A space must appear between the option and reserve.

If a stack segment is already present in the program, then the -STACK option changes the size of the existing segment. The linker will only increase the size of the existing stack area. If an attempt is made to decrease the size of the stack area, the linker issues an error.

LF95 does not allocate local variables on the stack except in these cases:

  • Procedures with RECURSIVE keyword
  • Procedures with the AUTOMATIC statement/attribute
  • The LF95 compiler does not have a compiler option to output the required stack size.

    A program will not necessarily allocate the maximum amount of stack at the time it is loaded into memory. If it needs more stack during execution, it will dynamically increase the stack.

    If your program exceeds the maximum amount of stack at runtime, increase the stack size with -STACK. Note that some recursive procedures and files with large arrays compiled with -nsav can use very large amounts of stack.

    Visual Studio Property

    The -stack option is set using the Linker|Stack property. This option can be set on the property page for the project only.


    LF95 hello.obj -stack 2000000 LF95 howdy.obj -stack 2000000:10000

    See Also

    Setting Build Options