[flang-commits] [flang] [flang] Add image_index to list of intrinsics and add tests (PR #79519)

Katherine Rasmussen via flang-commits flang-commits at lists.llvm.org
Tue Jan 30 15:30:58 PST 2024


================
@@ -1433,6 +1433,23 @@ static void CheckAssociated(evaluate::ActualArguments &arguments,
   }
 }
 
+// IMAGE_INDEX (F'2023 16.9.107)
+static void CheckImage_Index(evaluate::ActualArguments &arguments,
+    parser::ContextualMessages &messages) {
+  if (arguments[1] && arguments[0]) {
+    if (auto subArrShape{evaluate::GetShape(arguments[1]->UnwrapExpr())}) {
+      if (const auto *coarrayArgSymbol{UnwrapWholeSymbolOrComponentDataRef(
+              arguments[0]->UnwrapExpr())}) {
+        if (evaluate::ToInt64(*subArrShape->front()) !=
+            coarrayArgSymbol->Corank()) {
+          messages.Say(arguments[1]->sourceLocation(),
+              "The size of the 'sub=' argument for intrinsic 'image_index' must be equal to the corank of the 'coarray=' argument"_err_en_US);
----------------
ktras wrote:

@klausler Thanks for the review. I have updated the error message.

https://github.com/llvm/llvm-project/pull/79519


More information about the flang-commits mailing list