middle-end/32667 - document cpymem and memcpy exact overlap requirement

Message ID 20231123080116.2449B3858426@sourceware.org
State Accepted
Headers
Series middle-end/32667 - document cpymem and memcpy exact overlap requirement |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Richard Biener Nov. 23, 2023, 8 a.m. UTC
  The following amends the cpymem documentation to mention that exact
overlap needs to be handled gracefully, also noting that the target
runtime is expected to behave the same way.

OK?

Thanks,
Richard.

	PR middle-end/32667
	* md.texi (cpymem): Document that exact overlap of source
	and destination needs to work.  Mention the target runtime
	may not treat this case as undefined.
---
 gcc/doc/md.texi | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Patch

diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index df6725ffc9c..8743b393b3c 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -6915,8 +6915,11 @@  individually copied data units in the block.
 
 The @code{cpymem@var{m}} patterns need not give special consideration
 to the possibility that the source and destination strings might
-overlap. These patterns are used to do inline expansion of
-@code{__builtin_memcpy}.
+overlap.  An exeption is the case where source and destination are
+equal.  These patterns are used to do inline expansion of
+@code{__builtin_memcpy}.  The target runtime is expected to handle
+the case of an exact overlap of source and destination gracefully
+as GCC does not consider that undefined behavior.
 
 @cindex @code{movmem@var{m}} instruction pattern
 @item @samp{movmem@var{m}}