Skip to content

Commit

Permalink
[flang][hlfir] Added a TODO note for parameterized array component sh…
Browse files Browse the repository at this point in the history
…apes.

Without the TODO, MLIR verifier fails because of invalid hlfir.declare
or fir.alloca that lowering produces.

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D150911
  • Loading branch information
vzakhari committed May 19, 2023
1 parent 5db033e commit 280a3e4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion flang/lib/Lower/ConvertExprToHLFIR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,17 @@ class HlfirDesignatorBuilder {
llvm::SmallVector<mlir::Value> extents;
auto seqTy = hlfir::getFortranElementOrSequenceType(fieldType)
.cast<fir::SequenceType>();
for (auto extent : seqTy.getShape())
for (auto extent : seqTy.getShape()) {
if (extent == fir::SequenceType::getUnknownExtent()) {
// We have already generated invalid hlfir.declare
// without the type parameters and probably invalid storage
// for the variable (e.g. fir.alloca without type parameters).
// So this TODO here is a little bit late, but it matches
// the non-HLFIR path.
TODO(loc, "array component shape depending on length parameters");
}
extents.push_back(builder.createIntegerConstant(loc, idxTy, extent));
}
if (!hasNonDefaultLowerBounds(componentSym))
return builder.create<fir::ShapeOp>(loc, extents);

Expand Down

0 comments on commit 280a3e4

Please sign in to comment.