Skip to content

Commit 431d701

Browse files
committed
[Flang] Address review comments.
1 parent 2f5e255 commit 431d701

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

flang/lib/Lower/ConvertCall.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -924,16 +924,19 @@ static PreparedDummyArgument preparePresentUserCallActualArgument(
924924
if (hlfir::isFortranProcedureValue(dummyType)) {
925925
// Procedure pointer or function returns procedure pointer actual to
926926
// procedure dummy.
927-
if (actual.isProcedurePointer() ||
928-
actual.getType().isa<fir::BoxProcType>()) {
927+
if (actual.isProcedurePointer()) {
929928
actual = hlfir::derefPointersAndAllocatables(loc, builder, actual);
930929
return PreparedDummyArgument{actual, /*cleanups=*/{}};
931930
}
932931
// Procedure actual to procedure dummy.
933932
assert(actual.isProcedure());
934933
// Do nothing if this is a procedure argument. It is already a
935934
// fir.boxproc/fir.tuple<fir.boxproc, len> as it should.
936-
if (actual.getType() != dummyType)
935+
if (!actual.getType().isa<fir::BoxProcType>() &&
936+
actual.getType() != dummyType)
937+
// The actual argument may be a procedure that returns character (a
938+
// fir.tuple<fir.boxproc, len>) while the dummy is not. Extract the tuple
939+
// in that case.
937940
actual = fixProcedureDummyMismatch(loc, builder, actual, dummyType);
938941
return PreparedDummyArgument{actual, /*cleanups=*/{}};
939942
}

0 commit comments

Comments
 (0)