public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Procedure Pointer and OpenMP GFortran Bug
@ 2013-08-21 6:25 David Bal
0 siblings, 0 replies; only message in thread
From: David Bal @ 2013-08-21 6:25 UTC (permalink / raw)
To: gcc-bugs
There seems to be a bug involving procedure pointers and OpenMP when using the default(none) clause when starting a parallel region. This means that if there is a procedure pointer inside a parallel region, and a default(none) clause is present, a compile time error will occur. If the default(none) clause is removed, or replaced by default(shared), the program compiles properly.
I think GNU Fortran is confusing whether a procedure pointer is a variable or not. If it is a variable then it must be defined when default(none) is specified. However, it is not allowed as a variable name in a shared clause. Is a procedure pointer a variable or not?
FYI the Intel compiler allows all conventions shown below. I know Intel Fortran is often loose on enforcing standard compliance, so I don't know which method is right, but something should be done to allow a default(none) clause with procedure pointers.
Best Regards,
David Bal
P.S. This problem occurs with GFortran 4.6, 4.8 and the latest 4.9 experimental.
! EXAMPLE CODE BELOW
module test
contains
subroutine double(a)
integer, intent(in out) :: a
a = a * 2
end subroutine double
end module test
program procedure_pointer_openmp_bug
use test
implicit none
interface
subroutine My_Interface(A)
integer, intent(in out) :: a
end subroutine My_Interface
end interface
procedure (My_Interface), pointer :: math
integer, parameter :: nA = 10
integer, dimension(nA) :: A = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
integer :: i
math => double
! ***VERSION 1 - Error: ‘math’ not specified in enclosing parallel
! !$omp parallel do &
! !$omp default(none) &
! !$omp shared(A)
! ***VERSION 2 - Error: Object 'math' is not a variable at (1)
! !$omp parallel do &
! !$omp default(none) &
! !$omp shared(A, math)
! ***VERSION 3 - COMPILES AND RUNS
! !$omp parallel do &
! !$omp default(shared) &
! !$omp shared(A)
! ***VERSION 4 - COMPILES AND RUNS
!$omp parallel do &
!$omp shared(A)
do i = 1, nA
call math(A(i))
end do
!$omp end parallel do
write (*,*) A
end program procedure_pointer_openmp_bug
! EXAMPLE CODE ABOVE
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-08-21 6:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-21 6:25 Procedure Pointer and OpenMP GFortran Bug David Bal
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).