[flang-commits] [flang] [flang] Diagnose the impure procedure reference in finalization according to the rank of the entity (PR #85475)
Kelvin Li via flang-commits
flang-commits at lists.llvm.org
Fri Mar 15 15:41:11 PDT 2024
================
@@ -827,15 +827,21 @@ static const Symbol *HasImpureFinal(
return IsFinalizable(derived, nullptr, /*withImpureFinalizer=*/true, rank);
}
-const Symbol *HasImpureFinal(const Symbol &original) {
+const Symbol *HasImpureFinal(const Symbol &original, std::optional<int> rank) {
const Symbol &symbol{ResolveAssociations(original)};
if (symbol.has<ObjectEntityDetails>()) {
if (const DeclTypeSpec * symType{symbol.GetType()}) {
if (const DerivedTypeSpec * derived{symType->AsDerived()}) {
- // finalizable assumed-rank not allowed (C839)
- return evaluate::IsAssumedRank(symbol)
- ? nullptr
- : HasImpureFinal(*derived, symbol.Rank());
+ if (evaluate::IsAssumedRank(symbol)) {
+ // finalizable assumed-rank not allowed (C839)
+ return nullptr;
+ } else {
+ int actualRank{symbol.Rank()};
----------------
kkwli wrote:
Oh! Got it.
https://github.com/llvm/llvm-project/pull/85475
More information about the flang-commits
mailing list