-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[flang] Fixed regression in copy-in/copy-out #161259
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
Changes from 9 commits
632ed7b
97cbeed
9189ede
f572da2
91f9e67
f52136b
d60edf8
1e69803
94f69ed
42382e0
5eff815
68bab54
413718c
329445c
ad080f1
8792ba4
8fd9427
4371a28
23393fe
1c202be
3423413
80b2ccb
2cef85a
d93b7e2
2abf0cb
57d67d7
e85c4e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1493,32 +1493,21 @@ class CopyInOutExplicitInterface { | |
| return !actualTreatAsContiguous && dummyNeedsContiguity; | ||
| } | ||
|
|
||
| // Returns true, if actual and dummy have polymorphic differences | ||
| bool HavePolymorphicDifferences() const { | ||
| bool dummyIsAssumedRank{dummyObj_.type.attrs().test( | ||
| characteristics::TypeAndShape::Attr::AssumedRank)}; | ||
| bool actualIsAssumedRank{semantics::IsAssumedRank(actual_)}; | ||
| bool dummyIsAssumedShape{dummyObj_.type.attrs().test( | ||
| characteristics::TypeAndShape::Attr::AssumedShape)}; | ||
| bool actualIsAssumedShape{semantics::IsAssumedShape(actual_)}; | ||
| if ((actualIsAssumedRank && dummyIsAssumedRank) || | ||
| (actualIsAssumedShape && dummyIsAssumedShape)) { | ||
| // Assumed-rank and assumed-shape arrays are represented by descriptors, | ||
| // so don't need to do polymorphic check. | ||
| } else if (!dummyObj_.ignoreTKR.test(common::IgnoreTKR::Type)) { | ||
| // flang supports limited cases of passing polymorphic to non-polimorphic. | ||
| // These cases require temporary of non-polymorphic type. (For example, | ||
| // the actual argument could be polymorphic array of child type, | ||
| // while the dummy argument could be non-polymorphic array of parent | ||
| // type.) | ||
| bool dummyIsPolymorphic{dummyObj_.type.type().IsPolymorphic()}; | ||
| auto actualType{ | ||
| characteristics::TypeAndShape::Characterize(actual_, fc_)}; | ||
| bool actualIsPolymorphic{ | ||
| actualType && actualType->type().IsPolymorphic()}; | ||
| if (actualIsPolymorphic && !dummyIsPolymorphic) { | ||
| return true; | ||
| } | ||
| // These cases require temporary of non-polymorphic type. (For example, | ||
| // the actual argument could be polymorphic array of child type, | ||
| // while the dummy argument could be non-polymorphic array of parent | ||
| // type.) | ||
| if (dummyObj_.ignoreTKR.test(common::IgnoreTKR::Type)) { | ||
| return false; | ||
| } | ||
| auto actualType{characteristics::TypeAndShape::Characterize(actual_, fc_)}; | ||
| if (actualType && actualType->type().IsPolymorphic() && | ||
| !actualType->type().IsAssumedType() && | ||
| !dummyObj_.IsPassedByDescriptor(/*isBindC*/ false)) { | ||
|
||
| // Not passing a descriptor, so will need to make a copy of the data | ||
| // with a proper type. | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An actual argument that is
class(parent)would require a temporary for atype(parent)dummy; type extension isn't necessary.An actual argument that has a monomorphic type that is an extension of a
type(t)dummy will require a temporary unless it actually has no additional components or TBP overrides relative tot.