[flang-commits] [flang] [Flang][OpenMP] Data-sharing restrictions on assumed-size arrays (PR #189324)

Jack Styles via flang-commits flang-commits at lists.llvm.org
Tue Mar 31 01:21:01 PDT 2026


================
@@ -0,0 +1,48 @@
+!RUN: %python %S/../test_errors.py %s %flang -fopenmp
+
+! Assumed-size arrays are predetermined shared and may only appear in a SHARED clause
+subroutine test_assumed_size_array_dsa( arr, N )
+  implicit none
+  integer :: arr(*)
+  integer :: i, N
+
+  !$omp parallel
+
+  !$omp task shared(arr)
----------------
Stylie777 wrote:

In terms of reduction, I think there are examples which are being missed. The error you quoted in https://github.com/llvm/llvm-project/pull/189324#issuecomment-4156699036 covered subscripts, and in this case is correct. But for examples without subscripts, I think we are still missing diagnostics. Take the following example:
```
program main
  real :: a(*)
  integer :: i

  !$omp parallel do reduction(+:a)
  do i=1, 10
    a(1) = a(1) + 1
  end do
  !$omp end parallel do

end program
```
This example will create private copies of `a`, and we are not using subscripts so there does need to be some coverage to `reduction`.

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


More information about the flang-commits mailing list