https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89651

            Bug ID: 89651
           Summary: OpenMP private array uninitialized warning with -O
                    flag
           Product: gcc
           Version: 8.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jfeng33 at hotmail dot com
  Target Milestone: ---

A private array variable generates an uninitialized warning when compiled with
-O, -O1, -O2, -O3. Without optimization flag, no error.
==============================================
program omp_array_private
  use omp_lib

  integer ::  n
  real, allocatable :: t(:)
  real :: s

  n=10
  allocate(t(n),source=0.0)

!$omp parallel private(t)

        s=sum(t)

!$omp end parallel

end program omp_array_private
==============================================

compile flag : gfortran -O3 -fopenmp   -Wall

++++++++++++++++++++++++++++++++++++++++++++++
Results:


Warning: ‘t.dim[0].lbound’ may be used uninitialized in this function
[-Wmaybe-uninitialized]

Warning: ‘t.dim[0].ubound’ may be used uninitialized in this function
[-Wmaybe-uninitialized]


Warning: ‘t.offset’ may be used uninitialized in this function
[-Wmaybe-uninitialized]

Reply via email to