Explicitly state the behavior of inbounds with a null pointer.

See https://llvm.org/bugs/show_bug.cgi?id=31439; this reflects LLVM's
behavior in practice, and should be compatible with C/C++ rules.

Differential Revision: https://reviews.llvm.org/D28026



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295916 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eli Friedman 2017-02-23 00:48:18 +00:00
parent 5925762682
commit e597c2c861

View File

@ -7734,8 +7734,10 @@ offsets implied by the indices to the base address with infinitely
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. In cases where the base is a vector of pointers the
``inbounds`` keyword applies to each of the computations element-wise.
past the end. The only *in bounds* address for a null pointer in the
default address-space is the null pointer itself. In cases where the
base is a vector of pointers the ``inbounds`` keyword applies to each
of the computations element-wise.
If the ``inbounds`` keyword is not present, the offsets are added to the
base address with silently-wrapping two's complement arithmetic. If the