http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52970

             Bug #: 52970
           Summary: OpenMP Scoping Incorrect for Arrays of Parameters
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: ian.b...@nag.co.uk


Created attachment 27148
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27148
Program showing the problem

Hi,

   when using default( none ) for the scoping of variables in an OpenMP
parallel region gfortran complains that arrays of Parameters need scoping when
they don't as they are named constants, not variables. Interestingly scalar
Parameters behave correctly (sorry for any line wrap issues):

Wot now? cat test_par_open.f90 
program test_par_opemp

!$ use omp_lib
implicit none 


integer :: kk, jx,jy,jz
Integer, Parameter :: nsbcll = 27

Integer, Dimension( 1:nsbcll ), Parameter :: &
  nix = (/ 0,  -1,-1,-1, 0, 0, 0, 1, 1, 1, -1,-1,-1, 0, 0, 1, 1, 1, -1,-1,-1,
0, 0, 0, 1, 1, 1 /) , &
  niy = (/ 0,  -1, 0, 1,-1, 0, 1,-1, 0, 1, -1, 0, 1,-1, 1,-1, 0, 1, -1, 0,
1,-1, 0, 1,-1, 0, 1 /) , &
  niz = (/ 0,  -1,-1,-1,-1,-1,-1,-1,-1,-1,  0, 0, 0, 0, 0, 0, 0, 0,  1, 1, 1,
1, 1, 1, 1, 1, 1 /)

  !$omp parallel do default(none)  private(kk,jx,jy,jz)
do kk=1, nsbcll

    jx=nix(kk)
    jy= niy(kk)
    jz=niz(kk)
end do 
 !$omp end parallel do 


end program
Wot now? ~/Downloads/gcc-4.8/bin/gfortran --version
GNU Fortran (GCC) 4.8.0 20120408 (experimental)
Copyright © 2012 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

Wot now? ~/Downloads/gcc-4.8/bin/gfortran -fopenmp -W -Wall -pedantic -std=f95
test_par_open.f90 
test_par_open.f90: In function ‘test_par_opemp’:
test_par_open.f90:18:0: error: ‘nix’ not specified in enclosing parallel
test_par_open.f90:15:0: error: enclosing parallel
test_par_open.f90:19:0: error: ‘niy’ not specified in enclosing parallel
test_par_open.f90:15:0: error: enclosing parallel
test_par_open.f90:20:0: error: ‘niz’ not specified in enclosing parallel
test_par_open.f90:15:0: error: enclosing parallel

Note no error is generated for the scalar parameter nsbcll. This happens in
4.8.0, 4.6.2 and 4.5.2. Portland group, intel and oracle are all happy with the
above code.

The above code is attached,

Ian

Reply via email to