[flang-commits] [flang] [flang] Enumeration Type: (PR 4/5) Lowering (PR #193571)

via flang-commits flang-commits at lists.llvm.org
Sat Oct 10 19:49:16 PDT 2026


================
@@ -2924,6 +3056,91 @@ genIsPresentIfArgMaybeAbsent(mlir::Location loc, hlfir::Entity actual,
       .getResult();
 }
 
+// Lower NEXT/PREVIOUS of an enumeration type (F2023 16.9.151 and 16.9.164).
+static std::optional<hlfir::EntityWithAttributes> genEnumerationNextOrPrevious(
+    const Fortran::evaluate::SpecificIntrinsic &intrinsic,
+    CallContext &callContext) {
+  mlir::Location loc = callContext.loc;
+  fir::FirOpBuilder &builder = callContext.getBuilder();
+  const auto &args = callContext.procRef.arguments();
+  if (args.size() > 1 && args[1]) {
+    // FORALL scheduling ignores the STAT= write (see issue for #193571).
+    mlir::Operation *parent = builder.getInsertionBlock()->getParentOp();
+    if (mlir::isa<hlfir::ForallOp>(parent) ||
+        parent->getParentOfType<hlfir::ForallOp>())
+      TODO(loc, "NEXT/PREVIOUS with STAT= inside FORALL");
----------------
MattPD wrote:

The description now records the FORALL restriction and links the issue.

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


More information about the flang-commits mailing list