[flang-commits] [flang] [flang][OpenMP] Check DEFAULT(NONE) on metadirective loop variants (PR #210172)

Abid Qadeer via flang-commits flang-commits at lists.llvm.org
Thu Jul 23 08:53:57 PDT 2026


================
@@ -688,6 +843,12 @@ void OmpStructureChecker::Enter(const parser::ExecutionPartConstruct &x) {
         continue;
       }
 
+      // A standalone metadirective does not contain its associated loop in
+      // the parse tree, so name resolution cannot apply DEFAULT(NONE) to it.
+      if (variant.checkDefaultNoneInAssociatedLoop) {
+        CheckDefaultNoneInAssociatedLoop(*spec, rootLoop, defaultNoneDiagnosed);
+      }
----------------
abidh wrote:

I see that `CheckDefaultNoneInAssociatedLoop` runs before the `GetAffectedNestDepthWithReason` depth checks, so for a variant whose nest doesn't match (e.g. collapse(2) over a single loop) we'd emit the DEFAULT(NONE) diagnostics in addition to the "requires a nest of depth N…" error on the same loop. Is running the DSA check ahead of the depth gate intentional?

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


More information about the flang-commits mailing list