[PATCH] D78424: [flang] Added Semantic Checks for 2 Data constraints and fixed the semantic errors in 3 test cases

Tim Keith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 18 11:49:55 PDT 2020


tskeith requested changes to this revision.
tskeith added inline comments.
This revision now requires changes to proceed.


================
Comment at: flang/lib/Semantics/check-data.cpp:49
+      if (const auto *details{
+              (*symbol).detailsIf<semantics::ObjectEntityDetails>()}) {
+        if (details->commonBlock()) {
----------------
`symbol->detailsIf`


================
Comment at: flang/lib/Semantics/check-data.cpp:56
+            context_.Say(name.source,
+                "Data Object must not be in a named COMMON block"_err_en_US);
+          }
----------------
This message is misleading. It can be in a named common block in a block data program unit.
I suggest something like: "Data object must not be in a named COMMON block outside a BLOCK DATA program unit".


================
Comment at: flang/lib/Semantics/check-data.cpp:65
+        if ((lbound && !evaluate::ToInt64(*lbound)) ||
+            (ubound && !evaluate::ToInt64(*ubound))) {
+          context_.Say(name.source,
----------------
Rather than copying all of this from resolve-names-utils.cpp, why not figure out a way to share the code?


================
Comment at: flang/lib/Semantics/check-data.cpp:67
 void DataChecker::Leave(const parser::DataStmtConstant &dataConst) {
   if (auto *structure{
           std::get_if<parser::StructureConstructor>(&dataConst.u)}) {
----------------
`const auto` is better here.


================
Comment at: flang/lib/Semantics/check-data.cpp:96
+      context_.Say(source,
+          "Only right most reference of data object can be a pointer"_err_en_US);
+    }
----------------
I think "right-most part" is better.


================
Comment at: flang/lib/Semantics/check-data.cpp:96
+      context_.Say(source,
+          "Only right most reference of data object can be a pointer"_err_en_US);
+    }
----------------
tskeith wrote:
> I think "right-most part" is better.
Is it possible to point at the part that is a pointer rather than at the entire data-ref?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78424





More information about the llvm-commits mailing list