[flang-commits] [flang] [llvm] [flang] Enumeration Type: (PR 3/5) Intrinsics + I/O + Modules (PR #193235)

via flang-commits flang-commits at lists.llvm.org
Fri Jul 31 07:26:50 PDT 2026


================
@@ -1216,6 +1276,60 @@ static const Symbol *FindInaccessibleComponent(common::DefinedIo which,
   return FindInaccessibleComponent(which, derived, scope, visited);
 }
 
+// Finds a direct (effective) component whose type is an enumeration type,
+// expanding a derived-type list item into its components per F2023 12.6.3.  A
+// component that is itself processed by defined I/O is treated as a single
+// value and is not expanded, so its subtree is skipped (based off of
+// FindInaccessibleComponent).
+static const Symbol *FindEnumerationTypeComponent(common::DefinedIo which,
+    const DerivedTypeSpec &derived, const Scope &scope,
+    VisitedSymbolSet &visited) {
+  if (!visited.insert(&derived.typeSymbol()).second) {
----------------
kwyatt-ext wrote:

Good find.  I've modified it to erase `visited` on return and added a test for it.  On a separate note, I'm going to add an issue and reproducer for the other usage of `visited` that this was following - so your finding won't get lost.

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


More information about the flang-commits mailing list