https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92486
--- Comment #18 from Alexander Cherepanov <ch3root at openwall dot com> --- Adding a `memset` makes trunk fail too: ---------------------------------------------------------------------- #include <string.h> #include <stdio.h> struct s { char c; int i; }; __attribute__((noinline,noclone)) void f(struct s *p, struct s *q) { struct s w; memset(&w, 0, sizeof(struct s)); w = *q; memcpy(&w, q, sizeof(struct s)); *p = w; memcpy(p, &w, sizeof(struct s)); } int main() { struct s x; memset(&x, 1, sizeof(struct s)); struct s y; memset(&y, 2, sizeof(struct s)); f(&y, &x); for (unsigned char *p = (unsigned char *)&y; p < (unsigned char *)&y + sizeof(struct s); p++) printf("%d", *p); printf("\n"); } ---------------------------------------------------------------------- $ gcc -std=c11 -pedantic -Wall -Wextra test.c && ./a.out 11111111 $ gcc -std=c11 -pedantic -Wall -Wextra -O3 test.c && ./a.out 12221111 ---------------------------------------------------------------------- gcc x86-64 version: gcc (GCC) 10.0.1 20200320 (experimental) ----------------------------------------------------------------------