Index: flang/lib/Semantics/check-declarations.cpp =================================================================== --- flang/lib/Semantics/check-declarations.cpp +++ flang/lib/Semantics/check-declarations.cpp @@ -277,6 +277,12 @@ CheckContiguous(symbol); } CheckGlobalName(symbol); + if (symbol.attrs().test(Attr::ASYNCHRONOUS) && + !evaluate::IsVariable(symbol)) { + messages_.Say( + "An entity may not have the ASYNCHRONOUS attribute unless it is a variable"_err_en_US); + } + if (isDone) { return; // following checks do not apply } @@ -429,11 +435,6 @@ symbol.name()); } } - if (symbol.attrs().test(Attr::ASYNCHRONOUS) && - !evaluate::IsVariable(symbol)) { - messages_.Say( - "An entity may not have the ASYNCHRONOUS attribute unless it is a variable"_err_en_US); - } } void CheckHelper::CheckCommonBlock(const Symbol &symbol) { Index: flang/test/Semantics/resolve20.f90 =================================================================== --- flang/test/Semantics/resolve20.f90 +++ flang/test/Semantics/resolve20.f90 @@ -81,7 +81,9 @@ contains subroutine bar end subroutine + !ERROR: An entity may not have the ASYNCHRONOUS attribute unless it is a variable subroutine test + asynchronous test !ERROR: Abstract procedure interface 'foo2' may not be referenced call foo2() !ERROR: Abstract procedure interface 'f' may not be referenced