[flang-commits] [PATCH] D155970: [flang] Disallow ASYNCHRONOUS for subroutine
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Fri Jul 21 08:36:47 PDT 2023
klausler created this revision.
klausler added a reviewer: clementval.
klausler added a project: Flang.
Herald added subscribers: sunshaoce, jdoerfert.
Herald added a project: All.
klausler requested review of this revision.
The check for inappropriate usage of the ASYNCHRONOUS attribute
needed to be moved in declaration checking so that it can catch
attempts to use it on a subroutine.
https://reviews.llvm.org/D155970
Files:
flang/lib/Semantics/check-declarations.cpp
flang/test/Semantics/resolve20.f90
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
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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155970.542942.patch
Type: text/x-patch
Size: 1450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230721/8ff64358/attachment-0001.bin>
More information about the flang-commits
mailing list