[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
Tue Aug 25 08:18:55 PDT 2026


================
@@ -1865,7 +1865,23 @@ class HlfirBuilder {
 
   hlfir::EntityWithAttributes
   gen(const Fortran::evaluate::RankOneBoundElement &x) {
-    TODO(getLoc(), "rank-1 bound element lowering");
+    mlir::Location loc = getLoc();
+    auto &builder = getBuilder();
+    using ResTy = Fortran::evaluate::RankOneBoundElement::Result;
+    mlir::Type resultType =
+        getConverter().genType(ResTy::category, ResTy::kind);
+    // Evaluate the rank-1 base expression.
+    Fortran::lower::SomeExpr someExpr{Fortran::evaluate::AsGenericExpr(
+        Fortran::evaluate::Expr<Fortran::evaluate::SomeInteger>{
+            Fortran::common::Clone(x.base())})};
+    hlfir::Entity baseArray{Fortran::lower::convertExprToHLFIR(
----------------
jeanPerier wrote:

+1, I would favor updating ConvertVariable.cpp and intercept the ArraySpec with HasRankOneBound and do something custom at starting from the base.

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


More information about the flang-commits mailing list