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 @@ -437,6 +437,11 @@ 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) { diff --git a/flang/test/Semantics/resolve20.f90 b/flang/test/Semantics/resolve20.f90 --- a/flang/test/Semantics/resolve20.f90 +++ b/flang/test/Semantics/resolve20.f90 @@ -54,6 +54,10 @@ !ERROR: EXTERNAL attribute not allowed on 'bar' external :: bar + !ERROR: An entity may not have the ASYNCHRONOUS attribute unless it is a variable + asynchronous :: async + external :: async + !ERROR: PARAMETER attribute not allowed on 'm' parameter(m=2) !ERROR: PARAMETER attribute not allowed on 'foo'