This is the mail archive of the mailing list for the GCC 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]

[Bug fortran/33439] New: Incorrect error message for chunksize variable

The GNU compiler is asking that when a default(none)
clause is present on the OMP PARALLEL DO, and a chunk-size expression (in this
case just the variable fsize) appears in a schedule clause, that the variable
must appear in a shared or private clause.  Other compilers (PGI, Pathscale) do
not require that this be done.

I cannot find a justification for requiring that fsize be listed in a
private or shared clause.  It is referenced before the construct begins
execution, but not within the construct itself.  Admittedly, the OpenMP 2.5 
spec is a bit weak on scoping rules in this case, but the text at page 63 lines
25-28 hints to me that a variable that appears in a schedule clause is not
automatically a reference.  The text on page 36 lines 1-19 says that IF the
variable is declared private then the value used is not the private copy but
rather the value of the version external to the construct.  Again this
suggests that the variable in the schedule clause is outside the scope
of the construct.

> gfortran -c -fopenmp test.f90
test.f90: In function 'MAIN__':
test.f90:16: error: 'fsize' not specified in enclosing parallel
test.f90:16: error: enclosing parallel

> cat test.f90
program OMP_program
! derived from ISU's RTED_OpenMP/FORTRAN/SECTION_C/F_C_3_2_a.f90
!                    RTED_OpenMP/FORTRAN/SECTION_C/F_C_3_2_d.f90
  integer, parameter ::  nt=4
  double precision :: s,tmp
  double precision :: ARR(100)
  integer :: fsize,i

  call omp_set_num_threads(nt)
  s = 0.d0
  arr = 1.0d0
  tmp = 4.d0*atan(1.d0)
  fsize = int(sin(-0.25*tmp)*10.0)
  write(*,*) 'tmp, fsize',tmp, fsize

!$omp parallel do  default(none) shared(arr) private(i) reduction(+:s)
  do i=1,100
     s = s + arr(i)
  end do
!$omp end parallel do

  print *,'s =', s

end program OMP_program

           Summary: Incorrect error message for chunksize variable
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: longb at cray dot com
 GCC build triplet: x86_64-suse-linux
  GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-suse-linux

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