https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32667

--- Comment #74 from post+gcc at ralfj dot de ---
It is correct that restrict attributes do not cause problems for the *caller*.

However, the *callee* (memcpy) is itself a C program. If that program is
compiled with GCC or clang, then the generated code makes no promises at all
for what happens when the pointers are equal (and n > 0). This causes UB in the
callee.

In other words, the GCC compilation scheme produces UB inside libc, just like
it would be UB for a programmer to invoke memcpy in the same way.

Reply via email to