[flang-commits] [flang] [flang] Fixed regression in copy-in/copy-out (PR #161259)

via flang-commits flang-commits at lists.llvm.org
Wed Nov 5 13:28:51 PST 2025


================
@@ -1616,28 +1604,19 @@ bool MayNeedCopy(const ActualArgument *actual,
     if (!check.HaveArrayOrAssumedRankArgs()) {
       return false;
     }
-    if (check.HaveContiguityDifferences()) {
-      return true;
-    }
-    if (check.HavePolymorphicDifferences()) {
+    bool actualTreatAsContiguous{isContiguousActual ||
+        dummyObj->ignoreTKR.test(common::IgnoreTKR::Contiguous)};
----------------
jeanPerier wrote:

Is it clear in the specification of IGNORE_TKR(C) that it should not apply to contiguity differences coming from passing a CLASS(T) to a TYPE(T)?

I find it a bit weird because it does not protect the function from getting the same data layout if the CLASS(T) was first passed to a TYPE(T) assumed-shape before passing it to the TYPE(*) that should be made contiguous but has IGNORE_TKR(C).

So it does not seem to provide invariants guarantee for the function, but it causes this case where IGNORE_TKR(C) does not prevent a copy-in/out.

If there is a clear use case/spec, I am OK with this, but otherwise I think the IGNORE_TKR(C) should be part of `dummyObj->ignoreTKR.test(common::IgnoreTKR::Contiguous)` 

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


More information about the flang-commits mailing list