[flang] Fix regressions from testing pass
authorpeter klausler <pklausler@nvidia.com>
Wed, 26 Jun 2019 22:30:53 +0000 (15:30 -0700)
committerpeter klausler <pklausler@nvidia.com>
Fri, 28 Jun 2019 16:20:55 +0000 (09:20 -0700)
Original-commit: flang-compiler/f18@70ea3b4b09c25be45a41326c78d412dd5eb69d43
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false

flang/lib/evaluate/intrinsics.cc
flang/lib/semantics/resolve-names-utils.cc
flang/lib/semantics/resolve-names-utils.h
flang/lib/semantics/resolve-names.cc

index 939dfdf..ac5c58c 100644 (file)
@@ -1477,6 +1477,8 @@ std::optional<SpecificCall> 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{
index cf00e6b..cd90205 100644 (file)
@@ -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<std::string> intrinsics{".and.", ".eq.", ".eqv.", ".ge.", ".gt.",
index 3768f3e..6c2d2b1 100644 (file)
@@ -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.
index 9ada9d5..aa7f339 100644 (file)
@@ -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<ProcEntityDetails>() &&
+          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)) {