[flang-commits] [flang] 828bfbe - [flang] Suppress error meant to prevent discontiguous association whe… (#73175)

via flang-commits flang-commits at lists.llvm.org
Thu Nov 30 13:15:49 PST 2023


Author: Peter Klausler
Date: 2023-11-30T13:15:42-08:00
New Revision: 828bfbef173e82943e56aee5901641c70fc1ea14

URL: https://github.com/llvm/llvm-project/commit/828bfbef173e82943e56aee5901641c70fc1ea14
DIFF: https://github.com/llvm/llvm-project/commit/828bfbef173e82943e56aee5901641c70fc1ea14.diff

LOG: [flang] Suppress error meant to prevent discontiguous association whe… (#73175)

…n actual argument is contiguous

When an element of a contiguous pointer array or assumed-shape array is
associated as an actual argument with an assumed-size dummy array, don't
flag the usage as an error.

Added: 
    

Modified: 
    flang/lib/Semantics/check-call.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/check-call.cpp b/flang/lib/Semantics/check-call.cpp
index ca9fffaeeaf29ff..ec8f99ca6bf48ed 100644
--- a/flang/lib/Semantics/check-call.cpp
+++ b/flang/lib/Semantics/check-call.cpp
@@ -529,17 +529,18 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
               dummyName);
         }
         if (actualIsArrayElement && actualLastSymbol &&
-            IsPointer(*actualLastSymbol)) {
-          basicError = true;
-          messages.Say(
-              "Element of pointer array may not be associated with a %s array"_err_en_US,
-              dummyName);
-        }
-        if (actualLastSymbol && IsAssumedShape(*actualLastSymbol)) {
-          basicError = true;
-          messages.Say(
-              "Element of assumed-shape array may not be associated with a %s array"_err_en_US,
-              dummyName);
+            !evaluate::IsContiguous(*actualLastSymbol, foldingContext)) {
+          if (IsPointer(*actualLastSymbol)) {
+            basicError = true;
+            messages.Say(
+                "Element of pointer array may not be associated with a %s array"_err_en_US,
+                dummyName);
+          } else if (IsAssumedShape(*actualLastSymbol)) {
+            basicError = true;
+            messages.Say(
+                "Element of assumed-shape array may not be associated with a %s array"_err_en_US,
+                dummyName);
+          }
         }
       }
     }


        


More information about the flang-commits mailing list