[flang-commits] [PATCH] D146573: [flang] Catch attempt to apply ASYNCHRONOUS attribute to a non-variable

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon Mar 27 15:14:57 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGfe8abccbcd47: [flang] Catch attempt to apply ASYNCHRONOUS attribute to a non-variable (authored by klausler).

Changed prior to commit:
  https://reviews.llvm.org/D146573?vs=507139&id=508812#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146573/new/

https://reviews.llvm.org/D146573

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
@@ -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'
Index: flang/lib/Semantics/check-declarations.cpp
===================================================================
--- flang/lib/Semantics/check-declarations.cpp
+++ 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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146573.508812.patch
Type: text/x-patch
Size: 1081 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230327/72083dc6/attachment-0001.bin>


More information about the flang-commits mailing list