@mjg59 I don't think this is pathological or gcc's fault. this is natural UB => anything can happen.
the culprit here is the standard that says memcpy(NULL, NULL, 0) is UB IMO. (and as https://tech.lgbt/@pierogiburo/113634964183471754 suggests, this is being fixed :3)