This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/32502] New: Rejects valid OpenMP code due to orphaned construct with reduction clause
- From: "spam dot brian dot taylor at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Jun 2007 19:48:25 -0000
- Subject: [Bug fortran/32502] New: Rejects valid OpenMP code due to orphaned construct with reduction clause
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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