[flang-commits] [PATCH] D145255: [flang] Ensure "dtv" args are passed by descriptor when polymorphic
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Fri Mar 3 09:56:55 PST 2023
klausler created this revision.
klausler added a reviewer: clementval.
klausler added a project: Flang.
Herald added subscribers: sunshaoce, jdoerfert.
Herald added a project: All.
klausler requested review of this revision.
The predicate used to determine whether the initial "dtv" argument
to a user-defined derived type I/O procedure specified by a generic
interface that is not in the derived type definition is wrong.
The "dtv" argument must be passed via a descriptor whenever it is
polymorphic.
https://reviews.llvm.org/D145255
Files:
flang/lib/Semantics/runtime-type-info.cpp
Index: flang/lib/Semantics/runtime-type-info.cpp
===================================================================
--- flang/lib/Semantics/runtime-type-info.cpp
+++ flang/lib/Semantics/runtime-type-info.cpp
@@ -1112,15 +1112,18 @@
}
} else { // user defined derived type I/O
CHECK(proc->dummyArguments.size() >= 4);
+ const auto *ddo{std::get_if<evaluate::characteristics::DummyDataObject>(
+ &proc->dummyArguments[0].u)};
+ if (!ddo) {
+ return;
+ }
if (derivedTypeSpec &&
- !std::get<evaluate::characteristics::DummyDataObject>(
- proc->dummyArguments[0].u)
- .type.type()
- .IsTkCompatibleWith(evaluate::DynamicType{*derivedTypeSpec})) {
+ !ddo->type.type().IsTkCompatibleWith(
+ evaluate::DynamicType{*derivedTypeSpec})) {
// Defined I/O specific procedure is not for this derived type.
return;
}
- if (binding) {
+ if (ddo->type.type().IsPolymorphic()) {
isArgDescriptorSet |= 1;
}
switch (io.value()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145255.502170.patch
Type: text/x-patch
Size: 1098 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230303/cd300b37/attachment.bin>
More information about the flang-commits
mailing list