[flang-commits] [flang] [flang][OpenMP] Make static duration variables default to shared DSA (PR #142783)

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Thu Jun 5 11:37:53 PDT 2025


================
@@ -169,3 +169,39 @@ subroutine implicit_dsa_test8
     end do
   !$omp end task
 end subroutine
+
+! Test variables defined in modules default to shared DSA
+!DEF: /implicit_dsa_test9_mod Module
+module implicit_dsa_test9_mod
+ !DEF: /implicit_dsa_test9_mod/tm3a PUBLIC (InDataStmt) ObjectEntity COMPLEX(4)
+  complex tm3a/(0,0)/
+contains
+ !DEF: /implicit_dsa_test9_mod/implict_dsa_test9 PUBLIC (Subroutine) Subprogram
+  subroutine implict_dsa_test9
+    !$omp task
+      !$omp task
+        !DEF: /implicit_dsa_test9_mod/implict_dsa_test9/OtherConstruct1/OtherConstruct1/tm3a (OmpShared) HostAssoc COMPLEX(4)
+        tm3a = (1, 2)
+      !$omp end task
+    !$omp end task
+  !$omp taskwait
+  !REF: /implicit_dsa_test9_mod/tm3a
+  print *,tm3a
+  end subroutine
+end module
+
+! Test variables in data statement default to shared DSA
+!DEF: /implicit_dsa_test10 (Subroutine) Subprogram
+subroutine implicit_dsa_test10
+ !DEF: /implicit_dsa_test10/tm3a (Implicit, InDataStmt) ObjectEntity REAL(4)
+data tm3a /(0, 2)/
----------------
luporl wrote:

It would be nice to test the following cases too:
- variable with SAVE attribute
- common block
- variable that is part of a common block

This would make the behavior of this PR consistent with what was done for copyprivate, which is implemented in `IsSymbolPrivate`.

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


More information about the flang-commits mailing list