[flang-commits] [flang] [Flang][OpenMP] Permit THREADPRIVATE variables in EQUIVALENCE statements (PR #186696)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Sun Mar 15 13:31:23 PDT 2026


================
@@ -0,0 +1,19 @@
+! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
+! OpenMP Version 5.1
+! Check OpenMP construct validity for the following directives:
+! 2.21.2 Threadprivate Directive
+
+program threadprivate02
+  common /blk1/ a1
+  real :: a1
+  real :: eq_a
+  equivalence(eq_a, a1)
+
+  ! This is an extension to the OpenMP semantics, see https://github.com/llvm/llvm-project/issues/180493
+  !WARNING: A variable in a THREADPRIVATE directive used in an EQUIVALENCE statement is an OpenMP extension (variable 'a1' from common block '/blk1/') [-Wopen-mp-threadprivate-equivalence]
+  !$omp threadprivate(/blk1/)
+
+  !ERROR: A THREADPRIVATE variable cannot be in SHARED clause
+  !$omp parallel shared(eq_a)
+  !$omp end parallel
+end
----------------
eugeneepshteyn wrote:

github flagged missing EOL

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


More information about the flang-commits mailing list