[flang-commits] [flang] [flang][MIF] Fix ucobounds given in mif.alloc_coarray #207858 (PR #207935)

Jean-Didier PAILLEUX via flang-commits flang-commits at lists.llvm.org
Tue Jul 7 01:58:26 PDT 2026


https://github.com/JDPailleux created https://github.com/llvm/llvm-project/pull/207935

This PR provide a manior fix to issue #207858  when the `ucobound` array is passed to mif.alloc_coarray. This array was built from the values in `lcobound`.


>From 3112d9c9ce7242816f303be6825b5466a946f730 Mon Sep 17 00:00:00 2001
From: Jean-Didier Pailleux <jean-didier.pailleux at sipearl.com>
Date: Tue, 7 Jul 2026 09:56:19 +0200
Subject: [PATCH] [flang][MIF] Fix ucobounds given in mif.alloc_coarray for
 coarrays #207858

---
 flang/lib/Lower/MultiImageFortran.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/lib/Lower/MultiImageFortran.cpp b/flang/lib/Lower/MultiImageFortran.cpp
index dc84a00c29d10..e4374c276c069 100644
--- a/flang/lib/Lower/MultiImageFortran.cpp
+++ b/flang/lib/Lower/MultiImageFortran.cpp
@@ -330,7 +330,7 @@ Fortran::lower::genUpperCoBounds(Fortran::lower::AbstractConverter &converter,
     ucobounds = builder.createTemporary(loc, arrayType);
     mlir::Value ucovalue;
     for (size_t i = 0; i < corank - 1; i++) {
-      if (auto ub = object->coshape()[i].lbound().GetExplicit()) {
+      if (auto ub = object->coshape()[i].ubound().GetExplicit()) {
         auto ubExpr = ignoreEvConvert(*ub);
         ucovalue = fir::getBase(converter.genExprValue(loc, ubExpr, stmtCtx));
       } else {



More information about the flang-commits mailing list