https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124392
Bug ID: 124392
Summary: [OpenMP] Bogus ‘i’ not specified in enclosing ‘task’
for task with nested parallel with implicit private
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: openmp, rejects-valid
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Target Milestone: ---
Discussed in today's OpenMP base-lang meeting that the following should be
(probably) valid:
subroutine f(x)
integer :: x(*)
integer :: i
!$omp task default(none)
!$omp parallel do simd
do i = 1, 10
x(i) = i
end do
!$omp end task
end subroutine
which gives:
6 | !$omp parallel do simd
| ^
Error: ‘i’ not specified in enclosing ‘task’
* * *
There is an implicit 'private(parallel: i)'.
The spec states (in 7.1.1 Variables Referenced in a Construct, here
quoting TR14):
"Loop-iteration variables inside parallel, teams, taskgraph, or task-generating
constructs are private in the innermost such construct that encloses the
loop."
and
"Specifying a variable in a copyprivate clause or a data-sharing attribute
clause other than the private clause on a nested construct causes an implicit
reference to the variable in the enclosing construct."
* * *
But it could be regarded as referenced because 'simd' implies
'lastprivate(simd: i)' – which would make it shared on 'parallel', but for 'do
simd'?
→ An OpenMP specification issue related to composite directive will be opened.