[flang-commits] [PATCH] D123905: [flang] Fix intrinsic/generic interaction regression
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Sat Apr 16 18:13:51 PDT 2022
klausler updated this revision to Diff 423271.
klausler added a comment.
Merge two patches together (both need to be present to fix problem without adding a test failure)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123905/new/
https://reviews.llvm.org/D123905
Files:
flang/lib/Evaluate/intrinsics.cpp
flang/lib/Semantics/expression.cpp
Index: flang/lib/Semantics/expression.cpp
===================================================================
--- flang/lib/Semantics/expression.cpp
+++ flang/lib/Semantics/expression.cpp
@@ -2186,24 +2186,23 @@
}
if (!resolution) {
// Not generic, or no resolution; may be intrinsic
- if (!symbol->attrs().test(semantics::Attr::EXTERNAL)) {
- if (std::optional<SpecificCall> specificCall{context_.intrinsics().Probe(
- CallCharacteristics{ultimate.name().ToString(), isSubroutine},
- arguments, GetFoldingContext())}) {
- CheckBadExplicitType(*specificCall, *symbol);
- return CalleeAndArguments{
- ProcedureDesignator{std::move(specificCall->specificIntrinsic)},
- std::move(specificCall->arguments)};
- } else if (symbol->attrs().test(semantics::Attr::INTRINSIC)) {
- return std::nullopt;
+ bool isIntrinsic{symbol->attrs().test(semantics::Attr::INTRINSIC)};
+ if (!isIntrinsic && !isGenericInterface) {
+ resolution = symbol;
+ } else if (std::optional<SpecificCall> specificCall{
+ context_.intrinsics().Probe(
+ CallCharacteristics{
+ ultimate.name().ToString(), isSubroutine},
+ arguments, GetFoldingContext())}) {
+ CheckBadExplicitType(*specificCall, *symbol);
+ return CalleeAndArguments{
+ ProcedureDesignator{std::move(specificCall->specificIntrinsic)},
+ std::move(specificCall->arguments)};
+ } else {
+ if (isGenericInterface) {
+ EmitGenericResolutionError(*symbol, dueToNullActual);
}
- }
- if (isGenericInterface) {
- EmitGenericResolutionError(*symbol, dueToNullActual);
return std::nullopt;
- } else {
- // Neither a generic interface nor an intrinsic
- resolution = symbol;
}
}
if (resolution->GetUltimate().has<semantics::DerivedTypeDetails>()) {
Index: flang/lib/Evaluate/intrinsics.cpp
===================================================================
--- flang/lib/Evaluate/intrinsics.cpp
+++ flang/lib/Evaluate/intrinsics.cpp
@@ -2414,7 +2414,7 @@
"Cannot use intrinsic function '%s' as a subroutine"_err_en_US,
call.name);
}
- return std::nullopt; // TODO
+ return std::nullopt;
}
// Helper to avoid emitting errors before it is sure there is no match
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123905.423271.patch
Type: text/x-patch
Size: 2409 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220417/187a9aff/attachment-0001.bin>
More information about the flang-commits
mailing list