[flang-commits] [flang] [flang][Lower] Implement lowering for new expression kind used in explicit-shape-bounds-spec (PR #215403)

via flang-commits flang-commits at lists.llvm.org
Wed Oct 14 01:13:14 PDT 2026


================
@@ -3806,6 +3806,18 @@ MaybeExpr ExpressionAnalyzer::Analyze(const parser::FunctionReference &funcRef,
   if (analyzer.fatalErrors()) {
     return std::nullopt;
   }
+  // A mod file renders a RankOneBoundElement (a single element extracted from a
+  // rank-1 array bound) as a call to the synthetic builtin
+  // __builtin_rank1_bound_element(base, dim=N).  It has no true Fortran surface
+  // syntax and no backing intrinsic, so rebuild the node here when the mod file
+  // is read back in.
+  if (const auto *name{std::get_if<parser::Name>(
+          &std::get<parser::ProcedureDesignator>(call.t).u)};
+      name &&
+      name->source.ToString() ==
+          IntrinsicProcTable::BuiltinRank1BoundElementName) {
+    return AnalyzeRankOneBoundElement(funcRef.source, analyzer.GetActuals());
----------------
MattPD wrote:

Confirmed: A module written by the base compiler with that constructor now reads back correctly.

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


More information about the flang-commits mailing list