https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106566

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
            Summary|[OpenMP]                    |[OpenMP] declare simd fails
                   |                            |with with bogus "already
                   |                            |been host associated" for
                   |                            |module procedures

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Additionally, the following is not diagnosed – at least not for this example.

"For Fortran, a declarative directive must appear after any USE, IMPORT, and
IMPLICIT statements in a declarative context."

(The original example shows this issue. This is reported by other compilers and
is being fixed on the OpenMP examples side.)


Example - *FAILS* ("has already been host associated") but is *VALID*

module m
   integer, parameter :: NN = 1023
   integer :: a(NN)

 contains
   subroutine add_one2(p)
   implicit none   ! <<<< valid - must before declare
   !$omp declare simd(add_one2) linear(p: ref) simdlen(8)
   integer :: p

   p = p + 1
   end subroutine
end module


The following is *COMPILING* - as there is no MODULE:


   subroutine add_one2(p)
   !$omp declare simd(add_one2) linear(p: ref) simdlen(8)
   implicit none  ! <<<< invalid because after declare.
   integer :: p

   p = p + 1
   end subroutine

Note: This example is on purpose invalid as 'implicit none' has been moved
after 'omp declare'. Otherwise, it would be valid.

Reply via email to