[flang-commits] [PATCH] D119565: [flang] Avoid bogus error for specification expression
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Fri Feb 11 15:57:22 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7fbabe6ee421: [flang] Avoid bogus error for specification expression (authored by klausler).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119565/new/
https://reviews.llvm.org/D119565
Files:
flang/lib/Evaluate/check-expression.cpp
flang/lib/Semantics/check-declarations.cpp
flang/test/Semantics/resolve69.f90
Index: flang/test/Semantics/resolve69.f90
===================================================================
--- flang/test/Semantics/resolve69.f90
+++ flang/test/Semantics/resolve69.f90
@@ -64,3 +64,15 @@
line%value = 'ok'
Print *,Trim(line%value)
End Program
+
+!Not errors.
+subroutine outer
+ integer n
+ contains
+ character(n) function inner1()
+ inner1 = ''
+ end function inner1
+ function inner2()
+ real inner2(n)
+ end function inner2
+end subroutine outer
Index: flang/lib/Semantics/check-declarations.cpp
===================================================================
--- flang/lib/Semantics/check-declarations.cpp
+++ flang/lib/Semantics/check-declarations.cpp
@@ -34,7 +34,6 @@
class CheckHelper {
public:
explicit CheckHelper(SemanticsContext &c) : context_{c} {}
- CheckHelper(SemanticsContext &c, const Scope &s) : context_{c}, scope_{&s} {}
SemanticsContext &context() { return context_; }
void Check() { Check(context_.globalScope()); }
Index: flang/lib/Evaluate/check-expression.cpp
===================================================================
--- flang/lib/Evaluate/check-expression.cpp
+++ flang/lib/Evaluate/check-expression.cpp
@@ -526,18 +526,14 @@
} else {
return "dummy procedure argument";
}
+ } else if (&symbol.owner() != &scope_ || &ultimate.owner() != &scope_) {
+ return std::nullopt; // host association is in play
} else if (const auto *object{
ultimate.detailsIf<semantics::ObjectEntityDetails>()}) {
if (object->commonBlock()) {
return std::nullopt;
}
}
- for (const semantics::Scope *s{&scope_}; !s->IsGlobal();) {
- s = &s->parent();
- if (s == &ultimate.owner()) {
- return std::nullopt;
- }
- }
return "reference to local entity '"s + ultimate.name().ToString() + "'";
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119565.408086.patch
Type: text/x-patch
Size: 1880 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220211/6cffa7d3/attachment-0001.bin>
More information about the flang-commits
mailing list