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

            Bug ID: 107350
           Summary: [OpenMP] linear clause with non-scalar list items
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: openmp
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

I think the current OpenMP wording does not restrict the arguments to linear to
scalars.

Currently, a Fortran program like below (based on
libgomp.fortran/taskloop2.f90) compiles (and works at runtime) – but I am not
sure it should or not and whether it works reliably.

For C, it is rejected as
  linear clause applied to non-integral non-pointer variable with type ‘int[2]’

Expected: Consistency between Fortran and C/C++ - and if it is valid, ensuring
that it
works correctly. Assuming the spec permits it for both or none and not only for
Fortran.

* * *
   subroutine f2 (a, b, cx)
     integer, intent(in) :: a, b, cx
     integer :: c(5), d, e
     c = cx
     !$omp taskloop simd default(none) shared(u, v, w) linear(d:1) linear(c:5)
lastprivate(e)
     do d = a, b
       u(d) = v(d) + w(d)
       c = c + 5
      e = c(3) + 9
     end do
     !$omp end taskloop simd
     m = d + c(3) + e
   end subroutine f2

Reply via email to