Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flang] Suppress error meant to prevent discontiguous association whe… #73175

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

klausler
Copy link
Contributor

…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.

…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.
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:semantics labels Nov 22, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Nov 22, 2023

@llvm/pr-subscribers-flang-semantics

Author: Peter Klausler (klausler)

Changes

…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.


Full diff: https://github.com/llvm/llvm-project/pull/73175.diff

1 Files Affected:

  • (modified) flang/lib/Semantics/check-call.cpp (+12-11)
diff --git a/flang/lib/Semantics/check-call.cpp b/flang/lib/Semantics/check-call.cpp
index efc2cb0a291ddce..b7829362f315ee4 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);
+          }
         }
       }
     }

Copy link
Contributor

@vzakhari vzakhari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@klausler klausler merged commit 828bfbe into llvm:main Nov 30, 2023
5 checks passed
@klausler klausler deleted the razvan branch November 30, 2023 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:semantics flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants