Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,13 +528,10 @@ mlir::LLVM::DITypeAttr DebugTypeGenerator::convertSequenceType(
if (dim == seqTy.getUnknownExtent()) {
// This path is taken for both assumed size array or when the size of the
// array is variable. In the case of variable size, we create a variable
// to use as countAttr. Note that fir has a constant size of -1 for
// assumed size array. So !optint check makes sure we don't generate
// variable in that case.
// to use as countAttr.
if (declOp && declOp.getShape().size() > index) {
std::optional<std::int64_t> optint =
getIntIfConstant(declOp.getShape()[index]);
if (!optint)
if (!llvm::isa_and_nonnull<fir::AssumedSizeExtentOp>(
declOp.getShape()[index].getDefiningOp()))
countAttr = generateArtificialVariable(
context, declOp.getShape()[index], fileAttr, scope, declOp);
}
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Transforms/debug-assumed-size-array.fir
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module {
%c5 = arith.constant 5 : index
%c1 = arith.constant 1 : index
%c2 = arith.constant 2 : index
%c-1 = arith.constant -1 : index
%c-1 = fir.assumed_size_extent : index
%0 = fir.undefined !fir.dscope
%1 = fircg.ext_declare %arg0(%c5, %c-1) dummy_scope %0 {uniq_name = "_QMhelperFfnEa1"} : (!fir.ref<!fir.array<5x?xi32>>, index, index, !fir.dscope) -> !fir.ref<!fir.array<5x?xi32>> loc(#loc1)
%2 = fircg.ext_declare %arg1(%c-1) origin %c2 dummy_scope %0 {uniq_name = "_QMhelperFfnEa2"} : (!fir.ref<!fir.array<?xi32>>, index, index, !fir.dscope) -> !fir.ref<!fir.array<?xi32>> loc(#loc2)
Expand Down