[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
Tue Oct 13 16:52:21 PDT 2026


================
@@ -4262,7 +4301,9 @@ genTargetOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
     if (const semantics::Symbol *sym = object.sym())
       captureImplicitMap(*sym, /*forceAddressPreserving=*/true);
 
-  lower::pft::visitAllSymbols(eval, captureImplicitMap);
+  forEachParseTreeEval(eval, [&](lower::pft::Evaluation &e) {
+    lower::pft::visitAllSymbols(e, captureImplicitMap);
----------------
MattPD wrote:

At e604e9d and 384d1bb, `flang -fopenmp -fopenmp-version=52 -S -emit-llvm repro.f90 -o -` aborts on this file:

```fortran
subroutine dm_meta(y)
  integer :: y
  !$omp metadirective when(implementation={vendor(llvm)}: target defaultmap(none))
  block
    y = y + 1
  end block
end subroutine
```

With `map(tofrom: y)`, the example compiles. At the [merge base](https://github.com/llvm/llvm-project/commit/ae7f7ef515657eeb037e1cad045ade1a45cc7951), Flang leaves this BLOCK outside TARGET.

Flang diagnoses `y` in an explicit TARGET or a delimited metadirective. Could it diagnose `y` in this form too?


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


More information about the flang-commits mailing list