rsmith created this revision.
rsmith added reviewers: fhahn, rjmccall.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
rsmith requested review of this revision.

As suggested in https://reviews.llvm.org/D86815


Repository:
  rG LLVM Github Monorepo

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
+incompatible with Clang and LLVM (and with several other major compilers).
+
 C++ ABI library
 ---------------
 


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
+incompatible with Clang and LLVM (and with several other major compilers).
+
 C++ ABI library
 ---------------
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D86993: D... Richard Smith - zygoloid via Phabricator via cfe-commits

Reply via email to