https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71522
Bug ID: 71522 Summary: Wrong optimization of memcpy through a var of type long double Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: ch3root at openwall dot com Target Milestone: --- Source code: ---------------------------------------------------------------------- #include <string.h> #include <stdio.h> int main() { long double d; char s[sizeof d]; memcpy(&d, "AAAAAAAAAAAAAAA", sizeof d); memcpy(&s, &d, sizeof s); printf("%s\n", s); } ---------------------------------------------------------------------- Results: ---------------------------------------------------------------------- $ gcc -std=c11 -pedantic -Wall -Wextra test.c && ./a.out AAAAAAAAAAAAAAA $ gcc -std=c11 -pedantic -Wall -Wextra -O3 test.c && ./a.out AAAAAAAA ---------------------------------------------------------------------- gcc version: gcc (GCC) 7.0.0 20160613 (experimental) The effect is very similar to bug 71452 so, presumably, this also considered a bug.