diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp index 05fbf3aa4c1e1..a77a34913c982 100644 --- a/flang/lib/Lower/Bridge.cpp +++ b/flang/lib/Lower/Bridge.cpp @@ -1482,7 +1482,7 @@ class FirConverter : public Fortran::lower::AbstractConverter { auto lp = builder->create( loc, lb, ub, by, /*unordered=*/true, /*finalCount=*/false, explicitIterSpace.getInnerArgs()); - if (!loops.empty() || !outermost) + if ((!loops.empty() || !outermost) && !lp.getRegionIterArgs().empty()) builder->create(loc, lp.getResults()); explicitIterSpace.setInnerArgs(lp.getRegionIterArgs()); builder->setInsertionPointToStart(lp.getBody()); @@ -2198,7 +2198,7 @@ class FirConverter : public Fortran::lower::AbstractConverter { lengthParams.push_back(charBox->getLen()); else if (fir::isDerivedWithLenParameters(rhs)) TODO(loc, "assignment to derived type allocatable with " - "length parameters"); + "LEN parameters"); lhsRealloc = fir::factory::genReallocIfNeeded( *builder, loc, *lhsMutableBox, /*shape=*/llvm::None, lengthParams); diff --git a/flang/lib/Lower/ConvertExpr.cpp b/flang/lib/Lower/ConvertExpr.cpp index ebc2a3c62006d..7f3bcc8a36ed8 100644 --- a/flang/lib/Lower/ConvertExpr.cpp +++ b/flang/lib/Lower/ConvertExpr.cpp @@ -3661,7 +3661,7 @@ class ArrayExprLowering { // changed by concatenations). if ((mutableBox.isCharacter() && !mutableBox.hasNonDeferredLenParams()) || mutableBox.isDerivedWithLenParameters()) - TODO(loc, "gather rhs length parameters in assignment to allocatable"); + TODO(loc, "gather rhs LEN parameters in assignment to allocatable"); // The allocatable must take lower bounds from the expr if it is // reallocated and the right hand side is not a scalar.