Skip to content

Commit 4590955

Browse files
Polymorphic dummy with ignore rank
1 parent 413eafd commit 4590955

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

flang/lib/Evaluate/call.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,12 @@ static void DetermineCopyInOutArgument(
336336
bool dummyIsExplicitShape{dummyObj->type.IsExplicitShape()};
337337
bool dummyIsAssumedSize{dummyObj->type.attrs().test(
338338
characteristics::TypeAndShape::Attr::AssumedSize)};
339+
bool dummyIsPolymorphic{dummyObj->type.type().IsPolymorphic()};
340+
// Explicit shape and assumed size arrays must be contiguous
339341
bool dummyNeedsContiguity{dummyIsExplicitShape || dummyIsAssumedSize ||
340-
treatDummyScalarAsArray ||
342+
// Polymorphic dummy is descriptor based, so should be able to handle
343+
// discontigunity.
344+
(treatDummyScalarAsArray && !dummyIsPolymorphic) ||
341345
dummyObj->attrs.test(characteristics::DummyDataObject::Attr::Contiguous)};
342346
if (!actualTreatAsContiguous && dummyNeedsContiguity) {
343347
setCopyIn();
@@ -364,7 +368,6 @@ static void DetermineCopyInOutArgument(
364368
auto actualType{characteristics::TypeAndShape::Characterize(
365369
actual, sc.foldingContext())};
366370
bool actualIsPolymorphic{actualType->type().IsPolymorphic()};
367-
bool dummyIsPolymorphic{dummyObj->type.type().IsPolymorphic()};
368371
if (actualIsPolymorphic && !dummyIsPolymorphic) {
369372
setCopyIn();
370373
setCopyOut();

0 commit comments

Comments
 (0)