[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


================
@@ -1296,10 +1296,14 @@ static PreparedDummyArgument preparePresentUserCallActualArgument(
     Fortran::evaluate::FoldingContext &foldingContext{
         callContext.converter.getFoldingContext()};
 
-    bool suggestCopyIn = Fortran::evaluate::MayNeedCopy(
-        arg.entity, arg.characteristics, foldingContext, /*forCopyOut=*/false);
-    bool suggestCopyOut = Fortran::evaluate::MayNeedCopy(
-        arg.entity, arg.characteristics, foldingContext, /*forCopyOut=*/true);
+    bool suggestCopyIn = Fortran::evaluate::ActualArgNeedsCopy(
+                             arg.entity, arg.characteristics, foldingContext,
+                             /*forCopyOut=*/false)
+                             .value_or(false);
----------------
jeanPerier wrote:

I would expect `value_or(true)` here and just below (i.e., if we are not sure at compile time, we generate the code that will generate the copy conditionally at runtime based on the contiguity).

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


More information about the flang-commits mailing list