Skip to content

Commit 9b933e9

Browse files
authored
LangRef: getelementptr: inbounds is about the object the pointer is 'based on' (#95650)
As discussed in https://discourse.llvm.org/t/getelementptr-inbounds-inbounds-of-which-allocation/79024, we need the pointer to be inbounds of *the* allocated object the pointer is based on, not just any allocated object.
1 parent 5fe7f73 commit 9b933e9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/docs/LangRef.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11390,10 +11390,10 @@ For ``nuw`` (no unsigned wrap):
1139011390
For ``inbounds`` all rules of the ``nusw`` attribute apply. Additionally,
1139111391
if the ``getelementptr`` has any non-zero indices, the following rules apply:
1139211392

11393-
* The base pointer has an *in bounds* address of an allocated object, which
11394-
means that it points into an allocated object, or to its end. Note that the
11395-
object does not have to be live anymore; being in-bounds of a deallocated
11396-
object is sufficient.
11393+
* The base pointer has an *in bounds* address of the allocated object that it
11394+
is :ref:`based <pointeraliasing>` on. This means that it points into that
11395+
allocated object, or to its end. Note that the object does not have to be
11396+
live anymore; being in-bounds of a deallocated object is sufficient.
1139711397
* During the successive addition of offsets to the address, the resulting
1139811398
pointer must remain *in bounds* of the allocated object at each step.
1139911399

0 commit comments

Comments
 (0)