[flang-commits] [flang] [flang] Mark visible Cray pointer associations as aliasing (PR #221350)

via flang-commits flang-commits at lists.llvm.org
Thu Sep 17 10:01:43 PDT 2026


================
@@ -281,13 +281,16 @@ print *, target
 end
 ```
 
-By default, optimizations assume that Cray pointers do not alias any other
-variables. In the above example, it is assumed that `handle` and `target` do
-not alias, and optimizations will treat them as separate entities.
+By default, optimizations assume that Cray pointers do not alias other
+variables unless the association is visible in the same procedure. In the
+above example, `ptr = loc(target)` causes accesses through `handle` and
+`target` to be treated as potentially aliasing. Lowering gives `target` the
+TARGET attribute in FIR so that this information is available to all FIR
+optimizations.
----------------
junfengd-nv wrote:

Added.  Thanks for the suggestion.

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


More information about the flang-commits mailing list