[Bug fortran/89651] OpenMP private array uninitialized warning with -O flag
jfeng33 at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Mar 11 19:00:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89651
--- Comment #7 from Jim Feng <jfeng33 at hotmail dot com> ---
(In reply to Jakub Jelinek from comment #6)
> (In reply to Jim Feng from comment #5)
> > (In reply to Jakub Jelinek from comment #4)
> > > On the other side, the testcase is invalid, because you are summing
> > > uninitialized data. It is like if you did:
> > > program pr89651
> > > integer :: n
> > > real, allocatable :: t(:)
> > > n = 10
> > > allocate (t(n))
> > > print *, sum (t)
> > > end program pr89651
> > > but it is true gfortran doesn't warn here either. And we do warn even with
> > > firstprivate(t) when it is not undefined.
> >
> > In the test case, the array is initialized:
> >
> > allocate(t(n),source=0.0)
>
> Outside of the OpenMP region yes, but you are using private clause, and the
> privatized variable is just allocated, but not initialized. You'd need to
> use firstprivate(t) clause instead to copy the data too.
I just did firstprivate instead of private directive. Eaxct same error.
More information about the Gcc-bugs
mailing list