This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/44036] New: I can't declare an external function in an OMP shared statement.
- From: "kumbera1 at llnl dot gov" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 May 2010 23:32:25 -0000
- Subject: [Bug fortran/44036] New: I can't declare an external function in an OMP shared statement.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
If the OMP parallel default is set to 'none', then there
is no way to call an external function. As an example:
external f
!$OMP parallel default(none) &
!$OMP shared (f)
Because f is an external function then gfortran quits with the
error:
!$OMP shared (f)
1
Error: Object 'f' is not a variable at (1)
The enclosed example code doesn't work under 4.5. It works with
all other OpenMP fortran compilers that have been tried including
gfortran 4.3, intel, pgi, pathscale and IBM's XLf.
The current workaround is to use a OMP parallel default of shared
instead of none.
!$OMP parallel default(shared)
The following subroutine reproduces the error:
----
!gfortran -fopenmp -c g4.5_omp.f90
!gfortran --version = 4.5.0
subroutine dp (f,a,n)
implicit none
integer(8) f,a
integer(4) n
external f
integer i,j
!$OMP parallel default(none) &
!$OMP private (i,j) &
!$OMP shared (a,n,f)
! It FAILS with:
! !$OMP shared (a,n,f)
! 1
! Error: Object 'f' is not a variable at (1)
! If I leave f OFF the 'OMP shared' line then I get:
! g4.5_omp.f90: In function 'dp':
! g4.5_omp.f90:36:0: error: 'f' not specified in enclosing parallel
! g4.5_omp.f90:18:0: error: enclosing parallel
!$OMP do schedule (dynamic)
do i = 1, n
j = f(a,i)
enddo
!$omp end do
!$omp end parallel
return
end subroutine dp
--
Summary: I can't declare an external function in an OMP shared
statement.
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kumbera1 at llnl dot gov
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44036