[flang] Allow IMPLICIT NONE(EXTERNAL) with GenericDetails

Restrictions of IMPLICIT NONE(EXTERNAL) prohibits usage of c_associated from
iso_c_binding (with explicit interface) without external definiton - relax
associated check.

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D120971
This commit is contained in:
Mike Kashkarov 2022-03-01 02:16:47 +03:00
parent 35f48edb91
commit d2bcb0a129
2 changed files with 11 additions and 1 deletions

View File

@ -6495,7 +6495,9 @@ void ResolveNamesVisitor::HandleProcedureName(
if (!SetProcFlag(name, *symbol, flag)) {
return; // reported error
}
CheckImplicitNoneExternal(name.source, *symbol);
if (!symbol->has<GenericDetails>()) {
CheckImplicitNoneExternal(name.source, *symbol);
}
if (symbol->has<SubprogramDetails>() &&
symbol->attrs().test(Attr::ABSTRACT)) {
Say(name, "Abstract interface '%s' may not be called"_err_en_US);

View File

@ -0,0 +1,8 @@
! RUN: %python %S/test_errors.py %s %flang_fc1
use iso_c_binding, only: c_ptr, c_associated
implicit none(external)
type (c_ptr) :: cptr
if (.not. c_associated (cptr)) then
return
end if
end