Sun Studio 12 Update 1: Fortran User's Guide

3.4.163 –xrecursive

Allow routines without RECURSIVE attribute call themselves recursively.

Normally, only subprograms defined with the RECURSIVE attribute can call themselves recursively.

Compiling with -xrecursive enables subprograms to call themselves, even if they are not defined with the RECURSIVE attribute. But, unlike subroutines defined RECURSIVE, use of this flag does not cause local variables to be allocated on the stack by default. For local variables to have separate values in each recursive invocation of the subprogram, compile also with -stackvar to put local variables on the stack.

Indirect recursion (routine A calls routine B which then calls routine A) can give inconsistent results at optimization levels greater than -xO2. Compiling with the -xrecursive flag guarantees correctness with indirect recursion, even at higher optimization levels.

Compiling with -xrecursive can cause performance degradations.