@@ -213,23 +213,26 @@ mlir::LLVM::DITypeAttr DebugTypeGenerator::convertSequenceType(
213213 convertType (seqTy.getEleTy (), fileAttr, scope, declOp);
214214
215215 unsigned index = 0 ;
216+ auto intTy = mlir::IntegerType::get (context, 64 );
216217 for (fir::SequenceType::Extent dim : seqTy.getShape ()) {
218+ int64_t shift = 1 ;
219+ if (declOp && declOp.getShift ().size () > index) {
220+ if (std::optional<std::int64_t > optint =
221+ getIntIfConstant (declOp.getShift ()[index]))
222+ shift = *optint;
223+ }
217224 if (dim == seqTy.getUnknownExtent ()) {
225+ mlir::IntegerAttr lowerAttr = nullptr ;
226+ if (declOp && declOp.getShift ().size () > index)
227+ lowerAttr = mlir::IntegerAttr::get (intTy, llvm::APInt (64 , shift));
218228 // FIXME: This path is taken for assumed size arrays but also for arrays
219229 // with non constant extent. For the latter case, the DISubrangeAttr
220230 // should point to a variable which will have the extent at runtime.
221231 auto subrangeTy = mlir::LLVM::DISubrangeAttr::get (
222- context, /* count=*/ nullptr , /* lowerBound= */ nullptr ,
223- /* upperBound */ nullptr , /* stride*/ nullptr );
232+ context, /* count=*/ nullptr , lowerAttr, /* upperBound */ nullptr ,
233+ /* stride*/ nullptr );
224234 elements.push_back (subrangeTy);
225235 } else {
226- auto intTy = mlir::IntegerType::get (context, 64 );
227- int64_t shift = 1 ;
228- if (declOp && declOp.getShift ().size () > index) {
229- if (std::optional<std::int64_t > optint =
230- getIntIfConstant (declOp.getShift ()[index]))
231- shift = *optint;
232- }
233236 auto countAttr = mlir::IntegerAttr::get (intTy, llvm::APInt (64 , dim));
234237 auto lowerAttr = mlir::IntegerAttr::get (intTy, llvm::APInt (64 , shift));
235238 auto subrangeTy = mlir::LLVM::DISubrangeAttr::get (
0 commit comments