diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp --- a/flang/lib/Lower/Bridge.cpp +++ b/flang/lib/Lower/Bridge.cpp @@ -1482,7 +1482,7 @@ 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 @@ 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 --- a/flang/lib/Lower/ConvertExpr.cpp +++ b/flang/lib/Lower/ConvertExpr.cpp @@ -3661,7 +3661,7 @@ // 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.