This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Segmentation fault at runtime with OpenMP
On Thu, Feb 07, 2008 at 07:19:30AM -0500, Jakub Jelinek wrote:
> On Thu, Feb 07, 2008 at 01:02:58PM +0100, Tobias Burnus wrote:
> > Ignacio Fernández Galván wrote:
> > >Is there anything wrong with this code? It compiles fine with
> > >gfortran-20080206, but when I run the output I get a segmentation
> > >fault.
> > >
> > Using gfortran it does not crash here, but valgrind shows:
> >
> > ==10362== Use of uninitialised value of size 8
> > ==10362== at 0x400926: inner.902 (aa.f90:15)
> > ==10362== by 0x4008FA: MAIN__.omp_fn.0 (aa.f90:8)
> > ==10362== by 0x400875: MAIN__ (aa.f90:8)
> > ==10362== by 0x40095B: main (fmain.c:21)
> >
> >
> > The problem seems to be the variable k, which is uninitialized in the
> > subroutine "inner". Jakub, is the code valid or not?
>
> I believe it is invalid. The privatization affects the construct,
> not the subroutines it calls, and the subroutine thus uses the shared
> k (which is uninitialized).
> You can ask in www.openmp.org/forum/ if you want a definitive answer.
Actually, please don't, now I remember I've been dealing with this before.
See
http://www.openmp.org/pipermail/omp/2006/000532.html
Jakub