[flang-commits] [clang] [flang] [llvm] [clang][flang][OpenMP] Fix context selector matching and scoring (PR #224431)

via flang-commits flang-commits at lists.llvm.org
Fri Oct 9 01:04:39 PDT 2026


================
@@ -7743,15 +7801,26 @@ static void genMetadirective(lower::AbstractConverter &converter,
       TODO(variantLoc,
            "METADIRECTIVE with both block- and loop-associated variants");
 
-    genOMPDispatch(converter, symTable, semaCtx, eval, variantLoc, queue,
-                   queue.begin());
+    if (consumesBody) {
+      if (associatedBlockEval && associatedBlockEval->lowerAsUnstructured())
+        TODO(variantLoc,
+             "unstructured associated BLOCK in METADIRECTIVE variant");
+      mlir::SaveStateStack<OpenMPContextFrame> context{
+          converter.getStateStack(), eval, spec->DirId(),
+          /*isReplacement=*/true};
+      genOMPDispatch(converter, symTable, semaCtx, eval, variantLoc, queue,
----------------
MattPD wrote:

Confirmed at 9c59c04: The reported unsafe data-environment cases now receive the intended diagnostic.

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


More information about the flang-commits mailing list