[flang-commits] [flang] eae2d63 - Revert "[flang] Fix CheckSpecificationExpr handling of associated names"
Andrzej Warzynski via flang-commits
flang-commits at lists.llvm.org
Wed Nov 11 03:34:59 PST 2020
Author: Andrzej Warzynski
Date: 2020-11-11T11:33:16Z
New Revision: eae2d6357110fb48fd96ef04c48a38020b33b644
URL: https://github.com/llvm/llvm-project/commit/eae2d6357110fb48fd96ef04c48a38020b33b644
DIFF: https://github.com/llvm/llvm-project/commit/eae2d6357110fb48fd96ef04c48a38020b33b644.diff
LOG: Revert "[flang] Fix CheckSpecificationExpr handling of associated names"
This reverts commit b670189975f5ba4e8ef22c74724c610287b69c28.
This patch causes shared library builds (BUILD_SHARED_LIBS=ON) to fail:
* http://lab.llvm.org:8011/#/builders/33/builds/626
I wasn't able to identify any easy fix, hence reverting.
Added:
Modified:
flang/lib/Evaluate/check-expression.cpp
flang/test/Semantics/spec-expr.f90
Removed:
################################################################################
diff --git a/flang/lib/Evaluate/check-expression.cpp b/flang/lib/Evaluate/check-expression.cpp
index 57e20165a99c..f4348c5108b5 100644
--- a/flang/lib/Evaluate/check-expression.cpp
+++ b/flang/lib/Evaluate/check-expression.cpp
@@ -258,29 +258,30 @@ class CheckSpecificationExprHelper
Result operator()(const CoarrayRef &) const { return "coindexed reference"; }
Result operator()(const semantics::Symbol &symbol) const {
- const auto &ultimate{symbol.GetUltimate()};
- if (semantics::IsNamedConstant(ultimate) || ultimate.owner().IsModule() ||
- ultimate.owner().IsSubmodule()) {
+ if (semantics::IsNamedConstant(symbol)) {
return std::nullopt;
- } else if (scope_.IsDerivedType() &&
- IsVariableName(ultimate)) { // C750, C754
+ } else if (scope_.IsDerivedType() && IsVariableName(symbol)) { // C750, C754
return "derived type component or type parameter value not allowed to "
"reference variable '"s +
- ultimate.name().ToString() + "'";
- } else if (IsDummy(ultimate)) {
- if (ultimate.attrs().test(semantics::Attr::OPTIONAL)) {
+ symbol.name().ToString() + "'";
+ } else if (IsDummy(symbol)) {
+ if (symbol.attrs().test(semantics::Attr::OPTIONAL)) {
return "reference to OPTIONAL dummy argument '"s +
- ultimate.name().ToString() + "'";
- } else if (ultimate.attrs().test(semantics::Attr::INTENT_OUT)) {
+ symbol.name().ToString() + "'";
+ } else if (symbol.attrs().test(semantics::Attr::INTENT_OUT)) {
return "reference to INTENT(OUT) dummy argument '"s +
- ultimate.name().ToString() + "'";
- } else if (ultimate.has<semantics::ObjectEntityDetails>()) {
+ symbol.name().ToString() + "'";
+ } else if (symbol.has<semantics::ObjectEntityDetails>()) {
return std::nullopt;
} else {
return "dummy procedure argument";
}
+ } else if (symbol.has<semantics::UseDetails>() ||
+ symbol.has<semantics::HostAssocDetails>() ||
+ symbol.owner().kind() == semantics::Scope::Kind::Module) {
+ return std::nullopt;
} else if (const auto *object{
- ultimate.detailsIf<semantics::ObjectEntityDetails>()}) {
+ symbol.detailsIf<semantics::ObjectEntityDetails>()}) {
// TODO: what about EQUIVALENCE with data in COMMON?
// TODO: does this work for blank COMMON?
if (object->commonBlock()) {
@@ -289,11 +290,11 @@ class CheckSpecificationExprHelper
}
for (const semantics::Scope *s{&scope_}; !s->IsGlobal();) {
s = &s->parent();
- if (s == &ultimate.owner()) {
+ if (s == &symbol.owner()) {
return std::nullopt;
}
}
- return "reference to local entity '"s + ultimate.name().ToString() + "'";
+ return "reference to local entity '"s + symbol.name().ToString() + "'";
}
Result operator()(const Component &x) const {
diff --git a/flang/test/Semantics/spec-expr.f90 b/flang/test/Semantics/spec-expr.f90
index c02cabc04895..df856b3bd8dc 100644
--- a/flang/test/Semantics/spec-expr.f90
+++ b/flang/test/Semantics/spec-expr.f90
@@ -173,12 +173,3 @@ subroutine s15()
real, dimension((param + 2)) :: realField
end type dtype
end subroutine s15
-
-! Regression test: don't get confused by host association
-subroutine s16(n)
- integer :: n
- contains
- subroutine inner(r)
- real, dimension(n) :: r
- end subroutine
-end subroutine s16
More information about the flang-commits
mailing list