File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff 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 ();
You can’t perform that action at this time.
0 commit comments