[PATCH] D28026: Explicitly state the behavior of inbounds with a null pointer.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 21 11:55:26 PST 2016


efriedma created this revision.
efriedma added reviewers: rsmith, hfinkel.
efriedma added subscribers: llvm-commits, evstupac, dblaikie.
efriedma set the repository for this revision to rL LLVM.

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.


Repository:
  rL LLVM

https://reviews.llvm.org/D28026

Files:
  docs/LangRef.rst


Index: docs/LangRef.rst
===================================================================
--- docs/LangRef.rst
+++ docs/LangRef.rst
@@ -7573,8 +7573,10 @@
 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28026.82252.patch
Type: text/x-patch
Size: 903 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161221/e5edd6f9/attachment.bin>


More information about the llvm-commits mailing list