[flang-commits] [flang] [Flang][OpenMP] Reject array sections and subobjects in LINEAR clause (PR #197430)

Krzysztof Parzyszek via flang-commits flang-commits at lists.llvm.org
Thu May 21 11:51:30 PDT 2026


================
@@ -0,0 +1,64 @@
+! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
+! Verify that array sections and array elements in LINEAR clause are rejected.
+! The LINEAR clause requires a scalar variable name (OpenMP 4.5 ยง2.15.3.7).
+
+subroutine test_array_section_in_linear()
+  implicit none
+  integer :: i
+  integer, dimension(0:99, -99:10, 200) :: a, b, c
+
+  !$omp parallel
+    !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear in a LINEAR clause
+    !$omp do linear(a(:,1,1))
----------------
kparzysz wrote:

Section 7.4 "List Item Privatization" does not prohibit array sections other than non-contiguous array sections [6.0:221:34].

The "linear" clause description refers to section 7.5.3 ("private" clause), which then refers to section 7.4.  On the other hand "reduction" (which is also a privatizing clause) mentions array sections explicitly.

I'm inclined to agree that linear does not allow array sections.

https://github.com/llvm/llvm-project/pull/197430


More information about the flang-commits mailing list