https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111821
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2023-10-15 Ever confirmed|0 |1 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- here is a testcase where it happens at -O1 and above (and not just -Og): ``` typedef union { char a[1003263430]; } __attribute__((__packed__)) T; unsigned short f(const void *p) { unsigned short v; *(T *)(void *)(&v) = *(const T *)p; return v; } ``` Confirmed.