[flang-commits] [flang] [flang][Semantics] Break recursion on illegal recursive type in I/O check (PR #194284)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Fri May 1 08:58:50 PDT 2026


================
@@ -1147,11 +1156,22 @@ static const Symbol *FindUnsafeIoDirectComponent(common::DefinedIo which,
   return nullptr;
 }
 
+static const Symbol *FindUnsafeIoDirectComponent(common::DefinedIo which,
+    const DerivedTypeSpec &derived, const Scope &scope) {
+  VisitedSymbolSet visited;
+  return FindUnsafeIoDirectComponent(which, derived, scope, visited);
+}
+
 // For a type that does not have a defined I/O subroutine, finds a direct
 // component that is a witness to an accessibility violation outside the module
-// in which the type was defined.
+// in which the type was defined.  The 'visited' set tracks derived types to
+// break cycles caused by an illegal recursive type definition (F2023 C749).
 static const Symbol *FindInaccessibleComponent(common::DefinedIo which,
----------------
eugeneepshteyn wrote:

I thought about it. The thing is, the primary goal is to find inaccessible component. It skips recursively defined components now, thus avoiding infinite cycles, but this doesn't add to the diagnostics, it just allows diagnostics of recursive types to be done elsewhere. Given this, I'd rather keep the name.

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


More information about the flang-commits mailing list