[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 Aug 12 02:01:23 PDT 2026


================
@@ -580,8 +582,9 @@ void ArraySpecAnalyzer::Analyze(const parser::ExplicitShapeBoundsSpec &x) {
     MaybeSubscriptIntExpr ubExpr;
     if (auto &ubOrig = result->ubound.GetExplicit()) {
       if (ubOrig->Rank() > 0) {
-        ubExpr = SubscriptIntExpr{
-            evaluate::RankOneBoundElement{common::Clone(*ubOrig), dim}};
+        ubExpr = evaluate::Fold(context_.foldingContext(),
----------------
MattPD wrote:

I confirmed this on the PR head `b05b5f12`. With constant lower bounds and a dynamic upper bound, a unit compiled against the module sees lower bounds `[0,0]` instead of `[0,3]`. A compiler built from base commit `05c12f14` preserves `[0,3]`.

With dynamic lower bounds and constant upper bounds, a unit compiled against the module similarly sees the first upper bound repeated.

Suggestion: Test each mixed-bound form by checking the emitted module file and compiling a unit against the module.

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


More information about the flang-commits mailing list