[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
Sat Aug 1 00:52:27 PDT 2026
================
@@ -0,0 +1,73 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1 -fenumeration-type
+!
+! This test verifies that the transversal order for enumeration type components
+! does not impact the correct recognition/reporting of unformatted output
+! errors.
+
+module enum_pdt_order_mod
+ !WARNING: ENUMERATION TYPE support is incomplete and should be enabled only for testing
+ enumeration type :: color
+ enumerator :: red, green, blue
+ end enumeration type
+
+ type :: leaf(k)
+ integer, kind :: k = 2
+ type(color) :: c
+ end type
+
+ type :: branch(k)
+ integer, kind :: k = 2
+ type(leaf(k)) :: item
+ end type
+
+ ! Defined unformatted output for leaf(1) ONLY.
+ interface write(unformatted)
+ module procedure wleaf1
+ end interface
+
+ type :: container
+ type(branch(1)) :: a_safe
----------------
MattPD wrote:
`Scope` iterates components in `SourceName` order, not declaration order. That makes this test depend on the names chosen: `a_safe` sorts before `b_bad`, which is what puts the instantiation with defined I/O first. Renaming either component could make the test pass both with and without the fix, with nothing in the source showing why.
Would you note that dependency in this test, and add a second container with the names reversed, so the pair covers both traversal orders?
https://github.com/llvm/llvm-project/pull/193235
More information about the flang-commits
mailing list