[flang-commits] [flang] [flang][debug] Better handle array lower bound of assumed shape arrays. (PR #110302)
via flang-commits
flang-commits at lists.llvm.org
Mon Sep 30 04:01:11 PDT 2024
================
@@ -114,10 +114,19 @@ mlir::LLVM::DITypeAttr DebugTypeGenerator::convertBoxedSequenceType(
mlir::LLVM::DITypeAttr elemTy =
convertType(seqTy.getEleTy(), fileAttr, scope, declOp);
unsigned offset = dimsOffset;
+ unsigned index = 0;
+ mlir::IntegerType intTy = mlir::IntegerType::get(context, 64);
const unsigned indexSize = dimsSize / 3;
for ([[maybe_unused]] auto _ : seqTy.getShape()) {
// For each dimension, find the offset of count, lower bound and stride in
// the descriptor and generate the dwarf expression to extract it.
+ mlir::Attribute lowerAttr = nullptr;
+ // If declaration has a lower bound, use it.
+ if (declOp && declOp.getShift().size() > index) {
+ if (std::optional<std::int64_t> optint =
+ getIntIfConstant(declOp.getShift()[index]))
+ lowerAttr = mlir::IntegerAttr::get(intTy, llvm::APInt(64, *optint));
----------------
jeanPerier wrote:
Is it possible to leave a TODO note for the non constant case to do like for non constant character length? I do not think falling into reading the input descriptor lower bounds is correct.
```
subroutine foo(x, n)
integer :: n
real :: x(n:)
end subroutine
```
https://github.com/llvm/llvm-project/pull/110302
More information about the flang-commits
mailing list