@@ -3327,6 +3327,15 @@ behavior is undefined:
3327
3327
- the size of all allocated objects must be non-negative and not exceed the
3328
3328
largest signed integer that fits into the index type.
3329
3329
3330
+ Allocated objects that are created with operations recognized by LLVM (such as
3331
+ :ref:`alloca <i_alloca>`, heap allocation functions marked as such, and global
3332
+ variables) may *not* change their size. However, allocated objects can also be
3333
+ created by means not recognized by LLVM, e.g. by directly calling ``mmap``.
3334
+ Those allocated objects are allowed to grow to the right (i.e., keeping the same
3335
+ base address, but increasing their size), as long as they always satisfy the
3336
+ properties described above. Currently, allocated objects are not permitted to
3337
+ grow to the left or to shrink, nor can they have holes.
3338
+
3330
3339
.. _objectlifetime:
3331
3340
3332
3341
Object Lifetime
@@ -11870,6 +11879,9 @@ if the ``getelementptr`` has any non-zero indices, the following rules apply:
11870
11879
:ref:`based <pointeraliasing>` on. This means that it points into that
11871
11880
allocated object, or to its end. Note that the object does not have to be
11872
11881
live anymore; being in-bounds of a deallocated object is sufficient.
11882
+ If the allocated object can grow, then the relevant size for being *in
11883
+ bounds* is the maximal size the object could have while satisfying the
11884
+ allocated object rules, not its current size.
11873
11885
* During the successive addition of offsets to the address, the resulting
11874
11886
pointer must remain *in bounds* of the allocated object at each step.
11875
11887
0 commit comments