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]

Procedure Pointer and OpenMP GFortran Bug



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


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