This is the mail archive of the gcc-bugs@gcc.gnu.org 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/32502] New: Rejects valid OpenMP code due to orphaned construct with reduction clause


The following subroutine has an orphaned OpenMP "do" directive (i.e. no
enclosing "parallel" region in the program unit) containing a reduction clause.
 gfortran reports an error involving the scope of the reduction variable and
fails to compile the code.  I believe this code is valid.  For reference, using
xlf -qsmp=omp it compiles and runs without any warnings.

taylor@host $ cat test.f 
      subroutine test(u)
      implicit none
      real u(100), peak
      integer i
      peak = 0.0
!$omp do private(i) reduction(max:peak)
      do i = 1, 100
        peak = max(peak, abs(u(i)))
      end do
      end subroutine

taylor@host $ gfortran -fopenmp -c test.f 
test.f: In function 'test':
test.f:6: error: reduction variable 'peak' is private in outer context

taylor@host $ gfortran -v
Using built-in specs.
Target: powerpc-apple-darwin8.9.0
Configured with: ../gcc-4.3-20070511/configure --enable-languages=fortran
--enable-static --disable-shared
Thread model: posix
gcc version 4.3.0 20070511 (experimental)


-- 
           Summary: Rejects valid OpenMP code due to orphaned construct with
                    reduction clause
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: spam dot brian dot taylor at gmail dot com
  GCC host triplet: powerpc-apple-darwin8.8.0


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


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