&gt; The compiler is the implementation; it cannot cause &quot;undefined behavior&quot;.<p>The compiler is only <i>part</i> of the implementation.  So is the standard library.  So would be a processor.  An implementation as a whole, perhaps, cannot be said to cause &quot;undefined behavior&quot;, but I think it&#x27;s correct to say it&#x27;s <i>parts</i> certainly can.<p>If a preprocessor took valid C, and emitted valid C that could be fed into any other complete freestanding C implementation, would it not be accurate to say that this preprocessor introduced undefined behavior if it replaced, say, memmove(a, a, s) with memcpy(a, a, s) - sans any guarantees about which compiler it would have the emitted C fed into?<p>When it&#x27;s LLVM IR invoking glibc&#x27;s memcpy instead of a memmove, why is that not &quot;causing undefined behavior&quot;?  Because it&#x27;s not a C program?  And if I misinvoke it via C++, is it only undefined behavior because the C++ standard references the C one?  What if I use C# to invoke memcpy, which doesn&#x27;t?<p>&gt; An implementation is not bound by the standard in its own use of the standard library functions.<p>This is all well and true from a theoretical sense, but an implementation <i>is</i> bound to <i>it&#x27;s own</i> standards as a means of achieving a conforming compiler, and in this case those standards are clearly documented to mirror the standard&#x27;s standards.  These standards are being violated, leading to possible future misbehavior when combined with other optimizations which may leave the code behaving in indeterminate ways - and, for that matter, <i>current</i> misbehavior in the form of triggered &quot;false&quot; positive valgrind checks.<p>&gt; The implementation can use a function like memcpy in ways that would be formally undefined if they occured in user code; its implementation of memcpy just has to harmonize with that use, so that the intended behavior is ensured. This is because implementations can add their own requirements to areas that the standard leaves undefined. For instance, an implementation can add the requirement to its memcpy that the copy may overlap, if the destination has a lower address. Then, the implementation can generate code which uses memcpy that way, or make internal uses of memcpy from other library functions which use it that way. It&#x27;s just using its own (possibly not publicly documented) extension.<p>It <i>can</i> do these things, if the implementation as a whole is coordinated in this way, but I would hope for sanity&#x27;s sake it would not.  And in this case the implementation as a whole has <i>not</i> been coordinated in this way.<p>Invoke copy_forward from memcpy if you like, where the former has fewer preconditions - but to write code that relies on an implementation&#x27;s memcpy having fewer preconditions than the standard, even if you control the entire implementation, sounds untenable.  Someone <i>will</i> forget that your memcpy has fewer preconditions, and write optimizations, debug checks, etc. which misassume additional preconditions that are outlined by the C++ standard.  They <i>will also</i> also accidentally write code assuming fewer preconditions in another context where they&#x27;re not guaranteed some specific implementation&#x27;s relaxed preconditions.