[flang-commits] [flang] [flang] Disable copy-out to INTENT(IN) args (PR #192382)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Fri Apr 17 07:20:23 PDT 2026


================
@@ -1649,6 +1649,17 @@ std::optional<bool> ActualArgNeedsCopy(const ActualArgument *actual,
     // Expressions are copy-in, but not copy-out.
     return forCopyIn;
   }
+  if (forCopyOut) {
+    // If the actual argument's base object has INTENT(IN) in the caller's
+    // context, copy-out would violate the read-only semantics of INTENT(IN).
+    if (const Expr<SomeType> *expr{actual->UnwrapExpr()}) {
+      if (const Symbol *symbol{GetFirstSymbol(*expr)}) {
----------------
eugeneepshteyn wrote:

@jeanPerier , this is ready for another review, although I'll be re-running internal tests.

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


More information about the flang-commits mailing list