[flang-commits] [PATCH] D125343: [flang] Allow local variables and function result inquiries in specification expressions

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue May 10 16:47:19 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG2cd95504df57: [flang] Allow local variables and function result inquiries in specification… (authored by klausler).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125343

Files:
  flang/lib/Evaluate/check-expression.cpp


Index: flang/lib/Evaluate/check-expression.cpp
===================================================================
--- flang/lib/Evaluate/check-expression.cpp
+++ flang/lib/Evaluate/check-expression.cpp
@@ -114,7 +114,8 @@
   // been rewritten into DescriptorInquiry operations.
   if (const auto *intrinsic{std::get_if<SpecificIntrinsic>(&call.proc().u)}) {
     if (intrinsic->name == "kind" ||
-        intrinsic->name == IntrinsicProcTable::InvalidName) {
+        intrinsic->name == IntrinsicProcTable::InvalidName ||
+        call.arguments().empty() || !call.arguments()[0]) {
       // kind is always a constant, and we avoid cascading errors by considering
       // invalid calls to intrinsics to be constant
       return true;
@@ -539,7 +540,11 @@
         return std::nullopt;
       }
     }
-    return "reference to local entity '"s + ultimate.name().ToString() + "'";
+    if (inInquiry_) {
+      return std::nullopt;
+    } else {
+      return "reference to local entity '"s + ultimate.name().ToString() + "'";
+    }
   }
 
   Result operator()(const Component &x) const {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125343.428534.patch
Type: text/x-patch
Size: 1094 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220510/6fffcdc0/attachment-0001.bin>


More information about the flang-commits mailing list