[flang-commits] [flang] [flang][OpenMP] Fix segfault on module USE cycle with -fopenmp (PR #228037)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Tue Oct 13 08:51:35 PDT 2026


================
@@ -86,6 +86,15 @@ class SemanticsVisitor : public virtual BaseChecker, public virtual C... {
     if constexpr (common::HasMember<const N *, ConstructNode>) {
       context_.PushConstruct(node);
     }
+    if constexpr (std::is_same_v<decltype(Enter(node)), bool>) {
+      if (Enter(node)) {
+        return true;
+      }
+      if constexpr (common::HasMember<const N *, ConstructNode>) {
+        context_.PopConstruct();
+      }
+      return false;
+    }
     Enter(node);
----------------
eugeneepshteyn wrote:

If semantic analysis stops once name resolution has aborted its traversal, none of the later checkers sees the unresolved program units, so this `bool`-returning `Enter` path, and the `bool Enter` overloads added in `check-omp-structure.cpp`, would no longer be needed and could be dropped.


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


More information about the flang-commits mailing list