Using -fopenmp or -frecursive, local variables are put on the stack. This makes sense, but for the main program there is no need for the stack and the static memory can be used. This seems to be done what sunf95 does (contrary to ifort and gfortran).
The following example is based on the thread at http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/9a7daa8d75084b6b/ and using static memory should have no negative side effects. Example: Run the following program with -fopenmp or -frecursive and ulimit -S -s 8192 Due to this low stack size, it will crash. program sums implicit none integer, parameter :: sp = kind(1.0) integer, parameter :: dp = selected_real_kind(2*precision(1.0_sp)) integer, parameter :: num_steps = 2000000 real :: t1, t2 integer :: i, j real(kind=dp), dimension(0:num_steps-1) :: y call cpu_time(t1) y = 0.0_dp !$omp parallel do do j=0,num_steps-1 do i=0,49 y(j) = y(j) + 0.7_dp**i end do end do !$omp end parallel do call cpu_time(t2) print *, "y(end) = ", y(num_steps-1) print *, "Reached result in ", t2-t1, " seconds processor time." end program sums -- Summary: -frecursive: No need to use the stack for local variables of the main program Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34053