[flang-commits] [flang] [flang][coarray] Fix error fir.store mismatch memory reference type in genCoBounds #193131 (PR #194870)

via flang-commits flang-commits at lists.llvm.org
Mon May 4 07:46:46 PDT 2026


================
@@ -410,6 +410,8 @@ genCoBounds(Fortran::lower::AbstractConverter &converter, mlir::Location loc,
             std::get<1>(allocSpec.t)) {
       auto expr = Fortran::semantics::GetExpr(*lastCobound);
       lb = fir::getBase(converter.genExprValue(loc, expr, stmtCtx));
+      if (lb.getType() != i64Ty)
----------------
jeanPerier wrote:

Prefer using `lb = builder.createConvert(loc, i64Ty, lb);` without any condition. This helper will avoid generating the noisy/useless fir.convert if the type is already correct, and it is easier for the reader to understand that the `lb` is guaranteed to be i64Ty after that.

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


More information about the flang-commits mailing list