diff --git a/flang/lib/Semantics/check-declarations.cpp b/flang/lib/Semantics/check-declarations.cpp --- a/flang/lib/Semantics/check-declarations.cpp +++ b/flang/lib/Semantics/check-declarations.cpp @@ -201,7 +201,9 @@ } void CheckHelper::Check(const Symbol &symbol) { - if (symbol.name().size() > common::maxNameLen) { + if (symbol.name().size() > common::maxNameLen && + &symbol == &symbol.GetUltimate() && + !FindModuleFileContaining(symbol.owner())) { messages_.Say(symbol.name(), "%s has length %d, which is greater than the maximum name length " "%d"_port_en_US, @@ -616,7 +618,8 @@ messages_.Say("A dummy argument must not be initialized"_err_en_US); } else if (IsFunctionResult(symbol)) { messages_.Say("A function result must not be initialized"_err_en_US); - } else if (IsInBlankCommon(symbol)) { + } else if (IsInBlankCommon(symbol) && + !FindModuleFileContaining(symbol.owner())) { messages_.Say( "A variable in blank COMMON should not be initialized"_port_en_US); } @@ -1964,7 +1967,8 @@ } } } - if (derived->componentNames().empty()) { // C1805 + if (derived->componentNames().empty() && + !FindModuleFileContaining(symbol.owner())) { // C1805 messages_.Say(symbol.name(), "A derived type with the BIND attribute is empty"_port_en_US); } diff --git a/flang/lib/Semantics/resolve-names-utils.cpp b/flang/lib/Semantics/resolve-names-utils.cpp --- a/flang/lib/Semantics/resolve-names-utils.cpp +++ b/flang/lib/Semantics/resolve-names-utils.cpp @@ -464,7 +464,9 @@ } } } - if (msg) { + if (msg && + (!context_.IsInModuleFile(source) || + msg->severity() == parser::Severity::Error)) { context_.Say(source, std::move(*msg), sym1.name(), sym2.name()); return false; } diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp --- a/flang/lib/Semantics/resolve-names.cpp +++ b/flang/lib/Semantics/resolve-names.cpp @@ -173,6 +173,8 @@ } } + bool InModuleFile() const { return GetFoldingContext().inModuleFile(); } + // Make a placeholder symbol for a Name that otherwise wouldn't have one. // It is not in any scope and always has MiscDetails. void MakePlaceholder(const parser::Name &, MiscDetails::Kind); @@ -4835,7 +4837,8 @@ set_allowForwardReferenceToDerivedType(false); if (derivedTypeInfo_.sequence) { // C740 if (const auto *declType{GetDeclTypeSpec()}) { - if (!declType->AsIntrinsic() && !declType->IsSequenceType()) { + if (!declType->AsIntrinsic() && !declType->IsSequenceType() && + !InModuleFile()) { if (GetAttrs().test(Attr::POINTER) && context().IsEnabled(common::LanguageFeature::PointerInSeqType)) { if (context().ShouldWarn(common::LanguageFeature::PointerInSeqType)) { @@ -6635,7 +6638,7 @@ ApplyImplicitRules(*symbol); } if (checkIndexUseInOwnBounds_ && - *checkIndexUseInOwnBounds_ == name.source) { + *checkIndexUseInOwnBounds_ == name.source && !InModuleFile()) { Say(name, "Implied DO index '%s' uses an object of the same name in its bounds expressions"_port_en_US, name.source);