------ Old comment:
Makes sense it's undefined behavior, because address 0 is involved. Although I'd guess compiler implementations might just drop whole statement, because length is 0.
Zero length memory copy is a no-op.
Just like static zero iteration loop. They become zero instructions. (Except of course initialization that affects something outside loop scope.)
Edit:
Changed my mind after learning about the tricky UB pathway: If compiler can statically prove memcpy length argument to be zero, it can ALSO prove both argument pointers to be not NULL!
Ouch!