[Bug tree-optimization/92486] Wrong optimization: padding in structs is not copied even with memcpy
ch3root at openwall dot com
gcc-bugzilla@gcc.gnu.org
Tue Dec 3 18:56:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92486
--- Comment #16 from Alexander Cherepanov <ch3root at openwall dot com> ---
BTW this bug combines nicely with pr71460. Possible effects:
- padding in a long double inside a struct is lost on x86-64;
- sNaN is converted to qNaN in a double inside a struct on x86-32.
Both are illustrated at https://godbolt.org/z/VKmGbY . E.g., the former, this:
----------------------------------------------------------------------
#include <string.h>
struct s1 { long double d; };
void f1(struct s1 *restrict p, struct s1 *restrict q)
{
*p = *q;
memcpy(p, q, sizeof(struct s1));
}
----------------------------------------------------------------------
is compiled into this:
----------------------------------------------------------------------
f1:
fldt (%rsi)
fstpt (%rdi)
ret
----------------------------------------------------------------------
More information about the Gcc-bugs
mailing list