[flang-commits] [flang] [llvm] [mlir] [Flang][OpenMP] Fix Flang crash and incorrect ordering with OpenMP detached task (PR #194840)

Jack Styles via flang-commits flang-commits at lists.llvm.org
Tue May 5 02:01:48 PDT 2026


================
@@ -766,6 +766,17 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
         *parser::omp::GetOmpObjectList(x), Symbol::Flag::OmpLastPrivate);
     return false;
   }
+  bool Pre(const parser::OmpClause::Detach &x) {
+    // OpenMP 5.0: Variables in detach clause have predetermined shared
+    // data-sharing attribute
+    if (const auto *name{parser::Unwrap<parser::Name>(x.v.v)}) {
+      if (auto *symbol{name->symbol})
+        SetSymbolDSA(*symbol,
+            Symbol::Flags{
+                Symbol::Flag::OmpShared, Symbol::Flag::OmpPreDetermined});
----------------
Stylie777 wrote:

Makes sense, thanks!

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


More information about the flang-commits mailing list