diff options
author | Peter Klausler <35819229+klausler@users.noreply.github.com> | 2024-07-30 09:41:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-30 09:41:46 -0700 |
commit | 33c27f28d1cd05fd0a739498105927c1fba04666 (patch) | |
tree | 5ca6e4af27a84b63351da6346abf4905d61157d4 /flang/lib/Semantics/pointer-assignment.cpp | |
parent | 971a1ac4451017e625f81a4a8c15092c06dd2eb3 (diff) | |
download | llvm-33c27f28d1cd05fd0a739498105927c1fba04666.zip llvm-33c27f28d1cd05fd0a739498105927c1fba04666.tar.gz llvm-33c27f28d1cd05fd0a739498105927c1fba04666.tar.bz2 |
[flang] Warn about undefined function results (#99533)
When the result of a function never appears in a variable definition
context, emit a warning.
If the function has multiple result variables due to alternate ENTRY
statements, any definition will suffice.
The implementation of this check is tied to the general variable
definability checking utility in semantics. Every variable definition
context uses it to ensure that no undefinable variable is being defined.
A set of defined variables is maintained in the SemanticsContext and,
when the warning is enabled and no fatal error has been reported, the
scope tree is traversed and all the function subprograms' results are
tested for membership in that set.
Diffstat (limited to 'flang/lib/Semantics/pointer-assignment.cpp')
-rw-r--r-- | flang/lib/Semantics/pointer-assignment.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/flang/lib/Semantics/pointer-assignment.cpp b/flang/lib/Semantics/pointer-assignment.cpp index dae3b1a..4948fce 100644 --- a/flang/lib/Semantics/pointer-assignment.cpp +++ b/flang/lib/Semantics/pointer-assignment.cpp @@ -358,8 +358,10 @@ bool PointerAssignmentChecker::Check(const evaluate::Designator<T> &d) { Say(std::get<MessageFormattedText>(*msg)); } return false; + } else { + context_.NoteDefinedSymbol(*base); + return true; } - return true; } // Common handling for procedure pointer right-hand sides |