[flang-commits] [flang] [flang][OpenMP] don't privatise loop index marked shared (PR #108176)

Mats Petersson via flang-commits flang-commits at lists.llvm.org
Thu Sep 12 06:10:15 PDT 2024


================
@@ -1326,7 +1326,8 @@ class FirConverter : public Fortran::lower::AbstractConverter {
                                      bool isUnordered) {
     if (isUnordered || sym.has<Fortran::semantics::HostAssocDetails>() ||
         sym.has<Fortran::semantics::UseDetails>()) {
-      if (!shallowLookupSymbol(sym)) {
+      if (!shallowLookupSymbol(sym) &&
+          !sym.test(Fortran::semantics::Symbol::Flag::OmpShared)) {
----------------
Leporacanthicus wrote:

It doesn't work to just check for "not private", because if you compile that code without `-fopenmp` it will think it doesn't need to create a loop variable, which it should do. [I believe it should do, at least]. 

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


More information about the flang-commits mailing list