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

Krzysztof Parzyszek via flang-commits flang-commits at lists.llvm.org
Tue Mar 31 06:09:29 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)
----------------
kparzysz wrote:

Assumed-size arrays are not privatizable.  When I change the `program main` to `subroutine main(a)` above, I get a diagnostic:
```
asa1.f90:5:33: error: Whole assumed-size array 'a' may not appear here without subscripts
    !$omp parallel do reduction(+:a)
                                  ^
asa1.f90:2:11: Declaration of 'a'
    real :: a(*)
            ^
```
The code with `program main` will not compile because `a` must be a dummy argument.  Are you seeing a situation where we fail to reject an assumed-size array in a situation where it would be privatized?

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


More information about the flang-commits mailing list