Static Analysis Problem Type Reference
OpenMP* requires variables used in certain contexts to be shared variables.
Various OpenMP* constructs are used to control shared variables. These constructs don't make sense when they are applied to non-shared or "thread private" variables. Specifically ,PRIVATE variables may not appear in the variable list for a FIRSTPRIVATE or LASTPRIVATE directive. Similarly, a variable in a REDUCTION clause of a worksharing construct must be shared in the outer region. This diagnostic indicates that one of these constraints was violated.
|
ID |
Code Location |
Description |
|---|---|---|
|
1 |
OpenMP usage error |
The place where the non-shared variable was used improperly |
module mod
contains
subroutine sub(last, N)
integer last, i, N
!$OMP DO LASTPRIVATE(last)
do i = 1, N
last = i
end do
!$OMP END DO
end subroutine sub
end module mod
use mod
integer, parameter :: N=10
integer last
real, dimension(N) :: a
a = 1.0
!$OMP PARALLEL SHARED(a, b, c) PRIVATE(last)
call sub(last, N)
!$OMP END PARALLEL
end