This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: application crash if compiled with -fopenmp


Hi Daniel,

Daniel Franke wrote:
> Some digging showed that this can be easily reproduced:
> $> cat sigsegv.f90
>   real(8), dimension(10000000) :: largearray
>   largearray = 1.0_8
>   end
>
> [...]
>
> Is this intended and/or necessary for OMP?
>   
I remember having thought about this awhile ago. It is necessary that
the array is not in static memory in the following case:

subroutine foo(a)
   real(8), dimension(10000000) :: largearray
   largearray = a
   ! ...
end subroutine

The reason is that "foo" can be called by separate threads. However,
static memory can be used for the main function (PROGRAM / "MAIN_") for
obvious reasons.
You could specify "SAVE" which should help in this case. Or, if you are
sure no such competing calls are happening, you could also try
-fno-recursive.

See also:
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/9a7daa8d75084b6b/


ifort has the same problem whereas sunf95 seems to use static memory for
the main program. You could fill an enhancement request to use static
memory for the main program, even with -frecursive (which is implied by
-fopenmp).

Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]