[flang-commits] [flang] [flang] Propagate INTENT(IN) dummy arguments as readonly (PR #207732)

Sergey Shcherbinin via flang-commits flang-commits at lists.llvm.org
Sat Jul 11 10:17:52 PDT 2026


SergeyShch01 wrote:

Hi everyone, thank you all for the detailed and thoughtful comments. While investigating the raised cases, I found that the available guidance is not entirely consistent: the normative wording in F2023 8.5.10, together with the later explanation by Malcolm Cohen in J3/25-179r1, indicates that modifying an INTENT(IN) nonpointer dummy through a local pointer, or through a forwarded dummy without INTENT, is nonconforming, whereas Flang’s Aliasing.md describes these cases as conforming language holes. The latest revision follows the standard wording and therefore retains readonly for scalar INTENT(IN), including TARGET, and for scalar forwarding. If Aliasing.md reflects a different intended standards interpretation or there is additional rationale supporting that position, please let me know.

The latest commit limits direct-data propagation to by-reference non-character intrinsic scalars, excluding ordinary arrays and derived-type arguments because compiler-generated copy-out may otherwise violate LLVM readonly. It also adds shallow readonly support for INTENT(IN) POINTER and ALLOCATABLE descriptors: the descriptor storage is protected, while the addressed data remains writable. The affected lowering tests were updated, and new coverage was added for transitive copy-out, descriptor translation, and writable POINTER targets. 

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


More information about the flang-commits mailing list