https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96326
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|NEW |RESOLVED Target Milestone|--- |10.3 --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- The following works - your unsigned long objects are not aligned according to the type which makes the accesses undefined (actually C even specifies forming the pointer itself is undefined). #include <string.h> #include <stdio.h> typedef unsigned long mylong __attribute__((aligned(1))); int main() { char buf[128]; char *src = buf; char *op = buf + 3; int len = 64; strcpy(buf, "abc"); while (op - src < 8) { *(mylong*)op = *(const mylong*)src; len -= op - src; op += op - src; } while (len > 0) { *(mylong*)op = *(const mylong*)src; src += 8; op += 8; len -= 8; } printf("%ld\n", strlen(buf)); }