Skip to content

Commit be30cd6

Browse files
authored
[flang][lowering] Move PDT TODO before length param type lowering (#67650)
There is a crash before hitting the TODO when the length parameter kind depends on a KIND parameter. I do not want to fix it since I cannot test it because of the TODO, so I just moved to TODO up and added a comment.
1 parent 6cd5eb1 commit be30cd6

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

flang/lib/Lower/ConvertType.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -403,21 +403,26 @@ struct TypeBuilderImpl {
403403
cs.emplace_back(converter.getRecordTypeFieldName(component), ty);
404404
}
405405

406+
mlir::Location loc = converter.genLocation(typeSymbol.name());
406407
// (2) The LEN type parameters.
407408
for (const auto &param :
408409
Fortran::semantics::OrderParameterDeclarations(typeSymbol))
409410
if (param->get<Fortran::semantics::TypeParamDetails>().attr() ==
410-
Fortran::common::TypeParamAttr::Len)
411+
Fortran::common::TypeParamAttr::Len) {
412+
TODO(loc, "parameterized derived types");
413+
// TODO: emplace in ps. Beware that param is the symbol in the type
414+
// declaration, not instantiation: its kind may not be a constant.
415+
// The instantiated symbol in tySpec.scope should be used instead.
411416
ps.emplace_back(param->name().ToString(), genSymbolType(*param));
417+
}
412418

413419
rec.finalize(ps, cs);
414420
popDerivedTypeInConstruction();
415421

416-
mlir::Location loc = converter.genLocation(typeSymbol.name());
417422
if (!ps.empty()) {
418-
// This type is a PDT (parametric derived type). Create the functions to
419-
// use for allocation, dereferencing, and address arithmetic here.
420-
TODO(loc, "parameterized derived types");
423+
// TODO: this type is a PDT (parametric derived type) with length
424+
// parameter. Create the functions to use for allocation, dereferencing,
425+
// and address arithmetic here.
421426
}
422427
LLVM_DEBUG(llvm::dbgs() << "derived type: " << rec << '\n');
423428

0 commit comments

Comments
 (0)