[llvm] LangRef: allocated objects can grow (PR #141338)
Nuno Lopes via llvm-commits
llvm-commits at lists.llvm.org
Sat May 24 04:11:33 PDT 2025
================
@@ -11870,6 +11879,8 @@ if the ``getelementptr`` has any non-zero indices, the following rules apply:
:ref:`based <pointeraliasing>` on. This means that it points into that
allocated object, or to its end. Note that the object does not have to be
live anymore; being in-bounds of a deallocated object is sufficient.
+ If the allocated object can grow, then the relevant size for being *in
+ bounds* is the maximal size the object will ever have, not its current size.
----------------
nunoplopes wrote:
I think this semantics is problematic as you need to guess the future.
We need getelementptr to produce poison if it goes OOB, and with this wording, you need to delay the decision until the program exits, and then propagate it backwards.
This has implications in alias analysis. We would need to disable all rules that use reasoning such as `p + offset > p's size` to conclude no-alias, because the size may be increased later. We have a few of these rules in BasicAA.
https://github.com/llvm/llvm-project/pull/141338
More information about the llvm-commits
mailing list