Skip to content

[Flang] Get fir::SequenceType from hlfir::ExprType before getShape. #90055

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 2, 2024
Merged
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
11 changes: 7 additions & 4 deletions flang/lib/Lower/ConvertCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1184,12 +1184,15 @@ static PreparedDummyArgument preparePresentUserCallActualArgument(
// actual argument shape information. A descriptor with the dummy shape
// information will be created later when all actual arguments are ready.
mlir::Type dummyTypeWithActualRank = dummyType;
if (auto baseBoxDummy = mlir::dyn_cast<fir::BaseBoxType>(dummyType))
if (auto baseBoxDummy = mlir::dyn_cast<fir::BaseBoxType>(dummyType)) {
if (baseBoxDummy.isAssumedRank() ||
arg.testTKR(Fortran::common::IgnoreTKR::Rank) ||
arg.isSequenceAssociatedDescriptor())
dummyTypeWithActualRank =
baseBoxDummy.getBoxTypeWithNewShape(actual.getType());
arg.isSequenceAssociatedDescriptor()) {
mlir::Type actualTy =
hlfir::getFortranElementOrSequenceType(actual.getType());
dummyTypeWithActualRank = baseBoxDummy.getBoxTypeWithNewShape(actualTy);
}
}
// Preserve the actual type in the argument preparation in case IgnoreTKR(t)
// is set (descriptors must be created with the actual type in this case, and
// copy-in/copy-out should be driven by the contiguity with regard to the
Expand Down