public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "longb at cray dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/33439]  New: Incorrect error message for chunksize variable
Date: Fri, 14 Sep 2007 18:15:00 -0000	[thread overview]
Message-ID: <bug-33439-14710@http.gcc.gnu.org/bugzilla/> (raw)

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)
schedule(static,fsize)
  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


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


             reply	other threads:[~2007-09-14 18:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-14 18:15 longb at cray dot com [this message]
2007-09-17  8:05 ` [Bug fortran/33439] OpenMP: " burnus at gcc dot gnu dot org
2007-09-17  8:18 ` jakub at gcc dot gnu dot org
2007-09-17  8:21 ` burnus at gcc dot gnu dot org
2007-09-19 17:31 ` jakub at gcc dot gnu dot org
2007-09-20 16:42 ` jakub at gcc dot gnu dot org
2007-09-21 11:17 ` jakub at gcc dot gnu dot org
2007-10-20  4:09 ` jakub at gcc dot gnu dot org
2009-09-18 18:41 ` geir at cray dot com
2009-09-21 21:31 ` longb at cray dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-33439-14710@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).