https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62112
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> --- Main issue here is that DSE only applies to assignments and not function calls like memcpy (there must be a few dups somewhere), so we never remove memcpy, even if we call free(x);free(y); afterwards. With a for loop instead we optimize it just fine.