From: peter klausler Date: Wed, 26 Jun 2019 22:30:53 +0000 (-0700) Subject: [flang] Fix regressions from testing pass X-Git-Tag: llvmorg-12-init~9537^2~1029 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=737fe29f2bf86b13195e541a8dd5872a2f3d3042;p=platform%2Fupstream%2Fllvm.git [flang] Fix regressions from testing pass Original-commit: flang-compiler/f18@70ea3b4b09c25be45a41326c78d412dd5eb69d43 Reviewed-on: https://github.com/flang-compiler/f18/pull/531 Tree-same-pre-rewrite: false --- diff --git a/flang/lib/evaluate/intrinsics.cc b/flang/lib/evaluate/intrinsics.cc index 939dfdf..ac5c58c 100644 --- a/flang/lib/evaluate/intrinsics.cc +++ b/flang/lib/evaluate/intrinsics.cc @@ -1477,6 +1477,8 @@ std::optional IntrinsicProcTable::Implementation::Probe( } parser::Messages *finalBuffer{context.messages().messages()}; // Special case: NULL() + // All special cases handled here before the table probes below must + // also be caught as special names in IsIntrinsic(). if (call.name == "null") { parser::Messages nullBuffer; parser::ContextualMessages nullErrors{ diff --git a/flang/lib/semantics/resolve-names-utils.cc b/flang/lib/semantics/resolve-names-utils.cc index cf00e6b..cd90205 100644 --- a/flang/lib/semantics/resolve-names-utils.cc +++ b/flang/lib/semantics/resolve-names-utils.cc @@ -55,7 +55,7 @@ bool IsDefinedOperator(const SourceName &name) { return begin != end && begin[0] == '.' && end[-1] == '.'; } -bool IsInstrinsicOperator( +bool IsIntrinsicOperator( const SemanticsContext &context, const SourceName &name) { std::string str{name.ToString()}; std::set intrinsics{".and.", ".eq.", ".eqv.", ".ge.", ".gt.", diff --git a/flang/lib/semantics/resolve-names-utils.h b/flang/lib/semantics/resolve-names-utils.h index 3768f3e..6c2d2b1 100644 --- a/flang/lib/semantics/resolve-names-utils.h +++ b/flang/lib/semantics/resolve-names-utils.h @@ -50,7 +50,7 @@ parser::MessageFixedText WithIsFatal( // Is this the name of a defined operator, e.g. ".foo." bool IsDefinedOperator(const SourceName &); -bool IsInstrinsicOperator(const SemanticsContext &, const SourceName &); +bool IsIntrinsicOperator(const SemanticsContext &, const SourceName &); bool IsLogicalConstant(const SemanticsContext &, const SourceName &); // Analyze a generic-spec and generate a symbol name and GenericKind for it. diff --git a/flang/lib/semantics/resolve-names.cc b/flang/lib/semantics/resolve-names.cc index 9ada9d5..aa7f339 100644 --- a/flang/lib/semantics/resolve-names.cc +++ b/flang/lib/semantics/resolve-names.cc @@ -1695,7 +1695,12 @@ static bool NeedsType(const Symbol &symbol) { void ScopeHandler::ApplyImplicitRules(Symbol &symbol) { if (NeedsType(symbol)) { if (isImplicitNoneType()) { - Say(symbol.name(), "No explicit type declared for '%s'"_err_en_US); + if (symbol.has() && + context().intrinsics().IsIntrinsic(symbol.name().ToString())) { + // type will be determined in expression semantics + } else { + Say(symbol.name(), "No explicit type declared for '%s'"_err_en_US); + } } else if (const auto *type{GetImplicitType(symbol)}) { symbol.SetType(*type); } @@ -1859,7 +1864,7 @@ void ModuleVisitor::AddUse(const parser::Rename::Operators &ops) { const parser::DefinedOpName &use{std::get<1>(ops.t)}; GenericSpecInfo localInfo{local}; GenericSpecInfo useInfo{use}; - if (IsInstrinsicOperator(context(), local.v.source)) { + if (IsIntrinsicOperator(context(), local.v.source)) { Say(local.v, "Intrinsic operator '%s' may not be used as a defined operator"_err_en_US); } else if (IsLogicalConstant(context(), local.v.source)) {