diff --git a/docs/LangRef.html b/docs/LangRef.html index 95cbad06f6a..bed84232158 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -4954,7 +4954,7 @@ specified by the operation argument:

When indexing into a (optionally packed) structure, only i32 integer constants are allowed. When indexing into an array, pointer or vector, integers of any width are allowed, and they are not required to be - constant.

+ constant. These integers are treated as signed values where relevant.

For example, let's consider a C code fragment and how it gets compiled to LLVM:

@@ -5020,18 +5020,20 @@ entry: base pointer is not an in bounds address of an allocated object, or if any of the addresses that would be formed by successive addition of the offsets implied by the indices to the base address with infinitely - precise arithmetic are not an in bounds address of that allocated - object. The in bounds addresses for an allocated object are all - the addresses that point into the object, plus the address one byte past - the end.

+ precise signed arithmetic are not an in bounds address of that + allocated object. The in bounds addresses for an allocated object + are all the addresses that point into the object, plus the address one + byte past the end.

If the inbounds keyword is not present, the offsets are added to - the base address with silently-wrapping two's complement arithmetic, and - the result value of the getelementptr may be outside the object - pointed to by the base pointer. The result value may not necessarily be - used to access memory though, even if it happens to point into allocated - storage. See the Pointer Aliasing Rules - section for more information.

+ the base address with silently-wrapping two's complement arithmetic. If the + offsets have a different width from the pointer, they are sign-extended or + truncated to the width of the pointer. The result value of the + getelementptr may be outside the object pointed to by the base + pointer. The result value may not necessarily be used to access memory + though, even if it happens to point into allocated storage. See the + Pointer Aliasing Rules section for more + information.

The getelementptr instruction is often confusing. For some more insight into how it works, see the getelementptr FAQ.