diff options
Diffstat (limited to 'flang/lib/Semantics/pointer-assignment.cpp')
-rw-r--r-- | flang/lib/Semantics/pointer-assignment.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/flang/lib/Semantics/pointer-assignment.cpp b/flang/lib/Semantics/pointer-assignment.cpp index 69e80e5..54e36f5 100644 --- a/flang/lib/Semantics/pointer-assignment.cpp +++ b/flang/lib/Semantics/pointer-assignment.cpp @@ -279,6 +279,17 @@ bool PointerAssignmentChecker::Check(parser::CharBlock rhsName, bool isCall, } bool PointerAssignmentChecker::Check(const evaluate::ProcedureDesignator &d) { + if (const Symbol * symbol{d.GetSymbol()}) { + if (const auto *subp{ + symbol->GetUltimate().detailsIf<SubprogramDetails>()}) { + if (subp->stmtFunction()) { + evaluate::SayWithDeclaration(context_.messages(), *symbol, + "Statement function '%s' may not be the target of a pointer assignment"_err_en_US, + symbol->name()); + return false; + } + } + } if (auto chars{Procedure::Characterize(d, context_)}) { return Check(d.GetName(), false, &*chars, d.GetSpecificIntrinsic()); } else { |