https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119330
Bug ID: 119330
Summary: [OpenMP] GCC wrongly rejects depend(out:var%a(1:10))
Product: gcc
Version: 15.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: ---
The following is rejected by gfortran with:
12 | !$omp task depend(out:var%a(1:10))
| 1
Error: Syntax error in OpenMP variable list at (1)
That's wrong because 'depend' accepts a "list of locator list item type".
In OpenMP 5.2, it was still invalid - but that was a regression.
OpenMP 5.2 "3.2.1 OpenMP Argument Lists" [63:6-7]:
> Unless otherwise specified, a variable that is part of another variable
> (as an array element or a structure element) cannot be a variable list item,
> an extended list item or locator list item.
OpenMP 6.0 fixed this to:
> Unless otherwise specified, a variable that is part of an aggregate variable
> must not be a11 variable list item or an extended list item.
[OpenMP 5.0 and 5.1 had for depend: "The list items that appear in a depend
clause may use shape-operators."]
* * *
program depend
type :: dt
integer :: i
real, dimension(:), allocatable :: a
end type
type(dt) :: var
allocate(var%a(100))
!$omp parallel
!$omp single
!$omp task depend(out:var%a(1:10))
call sleep(2)
print *, 'A'
!$omp end task
!$omp task depend(in:var%a(1:10))
print *, 'B'
!$omp end task
!$omp end single
!$omp end parallel
end program depend