[flang-commits] [flang] [flang] Associate named constant actual arguments with their storage (PR #222986)
Eugene Epshteyn via flang-commits
flang-commits at lists.llvm.org
Mon Sep 14 19:54:09 PDT 2026
eugeneepshteyn wrote:
Implementation details:
Three coordinated pieces: semantics retains whole-array and array-element designators of named constants for procedure-reference actual arguments instead of replacing them with folded `Constant` values (folded back once a call resolves to an intrinsic, whose argument checks inspect values structurally); `ActualArgNeedsCopy` lets named-constant designators fall through to the physical-contiguity analysis instead of returning a blanket "copy-in"; and lowering's parameter-object temporary fires only when the copy analysis suggests a copy. Parenthesized designators, array constructors, and other true expressions keep their existing copy-to-temporary behavior.
This implements sequence association for named-constant array elements (F'2023 15.5.2.12) and, because the dummy argument now sees the declared object's address, makes address-based lookups work — e.g. an OpenACC `default(present)` check against a module named constant registered by `!$acc declare copyin` now finds the data. Safety for a callee that (non-conformingly) writes through such a dummy in a deeper call is provided by the runtime copy-out change in #222101, which skips stores for unmodified copy-backs; this PR should land after it.
https://github.com/llvm/llvm-project/pull/222986
More information about the flang-commits
mailing list