Skip to content

Commit a377b85

Browse files
authored
[flang] Adjust needless warning (llvm#164500)
When an external procedure has an explicit interface in one scope, and an implicit interface in another, and there's at least one call to it from which dummy argument information can be inferred, don't emit a warning about potential incompatibility if the only difference in their characteristics is that one of their interfaces was implicit.
1 parent d518f8e commit a377b85

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

flang/lib/Semantics/check-declarations.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,7 @@ void CheckHelper::CheckExternal(const Symbol &symbol) {
17811781
if (auto previousChars{Characterize(previous)}) {
17821782
std::string whyNot;
17831783
if (!chars->IsCompatibleWith(*previousChars,
1784-
/*ignoreImplicitVsExplicit=*/false, &whyNot)) {
1784+
/*ignoreImplicitVsExplicit=*/true, &whyNot)) {
17851785
if (auto *msg{Warn(common::UsageWarning::ExternalInterfaceMismatch,
17861786
"The external interface '%s' is not compatible with an earlier definition (%s)"_warn_en_US,
17871787
symbol.name(), whyNot)}) {

flang/test/Semantics/bug1491.f90

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
!RUN: %python %S/test_errors.py %s %flang_fc1 -Werror -pedantic
2+
module m
3+
interface
4+
integer function foo1()
5+
end function
6+
integer function foo2(j)
7+
end function
8+
integer function foo3()
9+
end function
10+
end interface
11+
end module
12+
13+
subroutine test()
14+
integer, external :: foo1
15+
!WARNING: The external interface 'foo2' is not compatible with an earlier definition (distinct numbers of dummy arguments) [-Wexternal-interface-mismatch]
16+
integer, external :: foo2
17+
integer, external :: foo3
18+
call bar(foo1())
19+
call bar(foo2())
20+
call baz(foo3)
21+
end subroutine

flang/test/Semantics/null-init.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module m6
3737

3838
module m7
3939
interface
40-
!WARNING: The external interface 'null' is not compatible with an earlier definition (incompatible procedure attributes: ImplicitInterface) [-Wexternal-interface-mismatch]
40+
!WARNING: The external interface 'null' is not compatible with an earlier definition (function results have incompatible attributes) [-Wexternal-interface-mismatch]
4141
function null() result(p)
4242
integer, pointer :: p
4343
end function

0 commit comments

Comments
 (0)