[flang-commits] [flang] [flang][OpenMP] Support for "omp assumes no_openmp". (PR #233252)

Sairudra More via flang-commits flang-commits at lists.llvm.org
Sun Oct 18 22:10:06 PDT 2026


================
@@ -6507,6 +6508,23 @@ class FirConverter : public Fortran::lower::AbstractConverter {
     builder->setFPMaxminBehavior(
         bridge.getLoweringOptions().getFPMaxminBehavior());
     builder->setInsertionPointToStart(&func.front());
+    for (const auto *assumptionScope = &scope;
+         !bridge.getSemanticsContext().langOptions().OpenMPSimd &&
+         !assumptionScope->IsGlobal();
----------------
Saieiei wrote:

With `-fopenmp-version=60`, this walk adds `omp_no_openmp` to a `bind(C)` procedure defined in a submodule, even when it contains a parallel region. OpenMP 6.0 section 10.6.2 scopes the assumption to code executed and reached from the current compilation unit and excludes propagation through module references. A submodule is a separate Fortran program unit, and C can call the procedure without entering the parent module. Could the lookup stop at `semantics::omp::GetProgramUnit(scope)`? That removes the attribute in the local test.

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


More information about the flang-commits mailing list