[PATCH] D86993: Document Clang's expectations of the C standard library.
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 1 17:12:53 PDT 2020
rsmith updated this revision to Diff 289329.
rsmith added a comment.
Add missing word.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86993/new/
https://reviews.llvm.org/D86993
Files:
clang/docs/Toolchain.rst
Index: clang/docs/Toolchain.rst
===================================================================
--- clang/docs/Toolchain.rst
+++ clang/docs/Toolchain.rst
@@ -276,6 +276,19 @@
`C standard library <https://en.cppreference.com/w/c>`_
implementations.
+Clang and LLVM make some assumptions about the behavior of the C standard
+library beyond those required by the C standard:
+
+* ``memcpy(p, q, 0)`` and ``memmove(p, q, 0)`` are expected to have no effect,
+ even if ``p`` or ``q`` is a null or otherwise-invalid (but correctly-aligned)
+ pointer.
+* ``memcpy(p, p, n)`` is expected to leave the contents of the memory pointed
+ to by ``p`` unchanged, but may perform (redundant) loads and stores through
+ the ``n`` bytes pointed to by ``p``.
+
+C standard library implementations that do not guarantee these properties are
+incompatible with Clang and LLVM (and with several other major compilers).
+
C++ ABI library
---------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86993.289329.patch
Type: text/x-patch
Size: 949 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200902/0273e8bd/attachment.bin>
More information about the cfe-commits
mailing list